Skip to content

Commit

Permalink
Update on "Check support_as_strided before using empty_strided."
Browse files Browse the repository at this point in the history
[ghstack-poisoned]
  • Loading branch information
Ailing Zhang committed Oct 22, 2020
1 parent 4ead60f commit d25723e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aten/src/ATen/native/TensorFactories.cpp
Expand Up @@ -348,7 +348,7 @@ Tensor empty_like(
if (memory_format == MemoryFormat::Preserve) {
if (self.is_non_overlapping_and_dense()) {
result = at::empty_strided(self.sizes(), self.strides(), options.memory_format(c10::nullopt));
} else if (self.support_as_strided() && self.layout() == kStrided) {
} else if (self.unsafeGetTensorImpl()->support_as_strided() && self.layout() == kStrided) {
// If input tensor is not dense and non-overlapping but strided, we will infer an output strides
// which keeps the layout permutation of the input tensor.
std::vector<int64_t> strides = infer_dense_strides(self.sizes(), self.strides());
Expand Down

0 comments on commit d25723e

Please sign in to comment.