Shut up "address will always evaluate to 'true'" warnings (#14774)
authorEdward Yang <ezyang@fb.com>
Thu, 6 Dec 2018 05:14:03 +0000 (21:14 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 6 Dec 2018 05:18:31 +0000 (21:18 -0800)
Summary:
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
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
caffe2/operators/negate_gradient_op.h
caffe2/operators/reservoir_sampling.cc
caffe2/operators/tensor_protos_db_input.h
caffe2/sgd/clip_tensor_op.h

index 0190aaf..db02e0d 100644 (file)
@@ -21,7 +21,7 @@ class MaxMinOpBase : public Operator<Context> {
     auto* output = Output(0);
 
     output->ResizeLike(input0);
-    output->CopyFrom(input0, &context_);
+    output->CopyFrom(input0, /* async */ true);
 
     if (InputSize() == 1) {
       return true;
index 8818ec3..f6f1bb2 100644 (file)
@@ -18,7 +18,7 @@ class NegateGradientOp final : public Operator<Context> {
     const auto& in = Input(0);
     auto* out = Output(0);
     if (out != &in) {
-      out->CopyFrom(in, &context_);
+      out->CopyFrom(in, /* async */ true);
     }
     return true;
   }
index 285dbba..df20c7f 100644 (file)
@@ -81,7 +81,7 @@ class ReservoirSamplingOp final : public Operator<Context> {
     if (num_entries == 0) {
       if (!output_initialized) {
         // Get both shape and meta
-        output->CopyFrom(input, &context_);
+        output->CopyFrom(input, /* async */ true);
       }
       return true;
     }
index fe20d3d..8ba2ff5 100644 (file)
@@ -102,7 +102,7 @@ bool TensorProtosDBInput<Context>::CopyPrefetched() {
   for (int i = 0; i < OutputSize(); ++i) {
     OperatorBase::template Output<Tensor>(i, Context::GetDeviceType())
         ->CopyFrom(
-            prefetched_blobs_[i].template Get<TensorCPU>(), &this->context_);
+            prefetched_blobs_[i].template Get<TensorCPU>(), /* async */ true);
   }
   return true;
 }
index d31dfb2..5792051 100644 (file)
@@ -51,7 +51,7 @@ class ClipTensorByScalingOp final : public Operator<Context> {
           &context_);
     } else {
       if (input_tensor_data != clipped_tensor_data) {
-        clipped->CopyFrom(input_tensor, &context_);
+        clipped->CopyFrom(input_tensor, /*async*/ true);
       }
     }