pytorch/c10
Vitaly Fedyunin 7b2e8c323c Add memory format argument to the clone operator (#27106)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27106

Adds memory_format option to the `clone` operator.

Introduce new `clone` behavior if used with `input_t.clone(memory_format=torch.preserve_format)`:
1) If tensor is non-overlapping and dense - output tensor will have the same strides as input tensor.
2) If not (1) and tensor is stored in the channels last format, output tensor going to have channels last format.
3) Output tensor is going to be contiguous in all other cases.

 ---
Dense tensor is the tensor that store values in a contiguous block of memory.
Non-overlapping tensor is the tensor in which elements occupy individual non-repetitive memory.

Test Plan: Imported from OSS

Differential Revision: D17699357

Pulled By: VitalyFedyunin

fbshipit-source-id: 5ae1537c2aca1abf0bf1eec4416846129c156f66
2019-10-03 12:08:47 -07:00
..
core Add memory format argument to the clone operator (#27106) 2019-10-03 12:08:47 -07:00
cuda Updates autograd engine to respect streams set in forward (#8354) 2019-09-10 23:46:51 -07:00
hip Revert "remove use of tmp_install" (#15847) 2019-01-08 16:30:19 -08:00
macros Switch internal CUDA build to C++14 (#26757) 2019-09-26 14:57:21 -07:00
test flat hash map that preserves insertion and deletion order (#25675) 2019-09-18 22:36:31 -07:00
util Revert "Add std::variant backport as c10::variant (#26836)" (#27277) 2019-10-03 09:33:48 -07:00
CMakeLists.txt c10::KernelFunction (#26337) 2019-09-20 18:55:25 -07:00