From a6399121da167606bd2c7390bcc9fffdaad43b5c Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Wed, 5 Dec 2018 21:14:03 -0800 Subject: [PATCH] Shut up "address will always evaluate to 'true'" warnings (#14774) Summary: Signed-off-by: Edward Z. Yang Pull Request resolved: https://github.com/pytorch/pytorch/pull/14774 Differential Revision: D13327969 Pulled By: ezyang fbshipit-source-id: 43380c89eedaaa89467952401b8fd3f5a9ad754a --- caffe2/operators/minmax_ops.h | 2 +- caffe2/operators/negate_gradient_op.h | 2 +- caffe2/operators/reservoir_sampling.cc | 2 +- caffe2/operators/tensor_protos_db_input.h | 2 +- caffe2/sgd/clip_tensor_op.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/caffe2/operators/minmax_ops.h b/caffe2/operators/minmax_ops.h index 0190aaf6b5f..db02e0dcb09 100644 --- a/caffe2/operators/minmax_ops.h +++ b/caffe2/operators/minmax_ops.h @@ -21,7 +21,7 @@ class MaxMinOpBase : public Operator { auto* output = Output(0); output->ResizeLike(input0); - output->CopyFrom(input0, &context_); + output->CopyFrom(input0, /* async */ true); if (InputSize() == 1) { return true; diff --git a/caffe2/operators/negate_gradient_op.h b/caffe2/operators/negate_gradient_op.h index 8818ec3502a..f6f1bb2485d 100644 --- a/caffe2/operators/negate_gradient_op.h +++ b/caffe2/operators/negate_gradient_op.h @@ -18,7 +18,7 @@ class NegateGradientOp final : public Operator { const auto& in = Input(0); auto* out = Output(0); if (out != &in) { - out->CopyFrom(in, &context_); + out->CopyFrom(in, /* async */ true); } return true; } diff --git a/caffe2/operators/reservoir_sampling.cc b/caffe2/operators/reservoir_sampling.cc index 285dbbaca93..df20c7fe2a8 100644 --- a/caffe2/operators/reservoir_sampling.cc +++ b/caffe2/operators/reservoir_sampling.cc @@ -81,7 +81,7 @@ class ReservoirSamplingOp final : public Operator { if (num_entries == 0) { if (!output_initialized) { // Get both shape and meta - output->CopyFrom(input, &context_); + output->CopyFrom(input, /* async */ true); } return true; } diff --git a/caffe2/operators/tensor_protos_db_input.h b/caffe2/operators/tensor_protos_db_input.h index fe20d3dd8d9..8ba2ff52e3f 100644 --- a/caffe2/operators/tensor_protos_db_input.h +++ b/caffe2/operators/tensor_protos_db_input.h @@ -102,7 +102,7 @@ bool TensorProtosDBInput::CopyPrefetched() { for (int i = 0; i < OutputSize(); ++i) { OperatorBase::template Output(i, Context::GetDeviceType()) ->CopyFrom( - prefetched_blobs_[i].template Get(), &this->context_); + prefetched_blobs_[i].template Get(), /* async */ true); } return true; } diff --git a/caffe2/sgd/clip_tensor_op.h b/caffe2/sgd/clip_tensor_op.h index d31dfb2c547..5792051eb3c 100644 --- a/caffe2/sgd/clip_tensor_op.h +++ b/caffe2/sgd/clip_tensor_op.h @@ -51,7 +51,7 @@ class ClipTensorByScalingOp final : public Operator { &context_); } else { if (input_tensor_data != clipped_tensor_data) { - clipped->CopyFrom(input_tensor, &context_); + clipped->CopyFrom(input_tensor, /*async*/ true); } }