From 5c84145354d6756a6a484390e3513e3c6d2cf509 Mon Sep 17 00:00:00 2001 From: Jerry Zhang Date: Tue, 27 Nov 2018 14:10:41 -0800 Subject: [PATCH] condition blob in while_op test changes data type (#14279) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/14279 att Reviewed By: smessmer Differential Revision: D13144472 fbshipit-source-id: af4d920a3148c648d1a428a5bcd56da19ea8c38c --- caffe2/core/blob.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/caffe2/core/blob.h b/caffe2/core/blob.h index 3873572..7726b6d 100644 --- a/caffe2/core/blob.h +++ b/caffe2/core/blob.h @@ -44,7 +44,10 @@ BlobGetMutableTensor(Blob* blob, at::IntList dims, at::TensorOptions options) { tensor->raw_mutable_data(); } else { // create a new Tensor when the data_type doesn't match - return BlobSetTensor(blob, caffe2::empty(dims, options)); + C10_LOG_EVERY_MS(WARNING, 1000) + << "data type mismatch in BlobGetMutableTensor:" + << tensor->dtype() << " and " << options.dtype(); + tensor->raw_mutable_data(options.dtype()); } return tensor; } -- 2.7.4