Remove caffe2::ShareData (#15418)
authorJerry Zhang <jerryzh@fb.com>
Tue, 8 Jan 2019 18:55:26 +0000 (10:55 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 8 Jan 2019 19:01:56 +0000 (11:01 -0800)
commitede1f4ad05bbf6c7d483ea105d2d8bc451ead437
tree4eaf50786abb7530216263372524c6fdb3e1fcf6
parent8232bd526fbf6b3720378e8d5a4ed93f284a4812
Remove caffe2::ShareData (#15418)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15418

Previously we are using Resize + ShareData.
Instead, we'll create a function on Tensor that clones itself with same storage.

Suppose we want `t` to `ShareData` with `t0`, Previous:
```
Tensor t(dims, CPU);
t.Resize(t0.sizes());
t.ShareData(t0);
```
Now:
```
Tensor t = t0.Alias();
```

Reviewed By: dzhulgakov

Differential Revision: D13507609

fbshipit-source-id: 6e4275d02f4c3356cbce91127f1b01111dc86b9f
aten/src/ATen/test/tensor_interop_test.cpp
c10/core/TensorImpl.h
caffe2/core/blob_gpu_test.cc
caffe2/core/blob_test.cc
caffe2/core/operator.h
caffe2/core/tensor.h
caffe2/ideep/operators/operator_fallback_ideep.h
caffe2/operators/softmax_ops.cu
caffe2/operators/string_ops_test.cc
caffe2/operators/utility_ops.h
caffe2/predictor/predictor_test.cc