From: Edward Yang Date: Thu, 6 Dec 2018 05:14:03 +0000 (-0800) Subject: Shut up "address will always evaluate to 'true'" warnings (#14774) X-Git-Tag: accepted/tizen/6.5/unified/20211028.231830~2437 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a6399121da167606bd2c7390bcc9fffdaad43b5c;p=platform%2Fupstream%2Fpytorch.git 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 --- diff --git a/caffe2/operators/minmax_ops.h b/caffe2/operators/minmax_ops.h index 0190aaf..db02e0d 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 8818ec3..f6f1bb2 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 285dbba..df20c7f 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 fe20d3d..8ba2ff5 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 d31dfb2..5792051 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); } }