• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #pragma once
2 
3 #include <ATen/core/Tensor.h>
4 #include <ATen/miopen/miopen-wrapper.h>
5 #include <ATen/miopen/Handle.h>
6 
7 namespace at { namespace native {
8 
9 // This function makes tensors which have zero stride contiguous, by
10 // setting the strides to 1.
contiguousIfZeroInStrides(const Tensor & t)11 inline Tensor contiguousIfZeroInStrides(const Tensor& t) {
12   for (auto s : t.strides()) {
13     if (s == 0) return t.contiguous();
14   }
15   return t;
16 }
17 
18 }}
19