Home / Class/ fixSizeOneDimStride Class — pytorch Architecture

fixSizeOneDimStride Class — pytorch Architecture

Architecture documentation for the fixSizeOneDimStride class in Descriptors.h from the pytorch codebase.

Entity Profile

Source Code

aten/src/ATen/miopen/Descriptors.h lines 25–48

template <typename T>
static inline void fixSizeOneDimStride(int dim, const T *size, T *stride, bool nhwc) {
  int64_t z = 1;
  int index = 0;
  std::vector<int> permutation(dim);

  if (nhwc) {
    permutation[index++] = 1;
  }
  for (int d = dim-1; d > 1; d--) {
    permutation[index++] = d;
  }
  if (!nhwc) {
    permutation[index++] = 1;
  }
  permutation[index++] = 0;
  for (int d : permutation) {
    if (size[d] == 1) {
      stride[d] = z;
    } else {
      z *= size[d];
    }
  }
}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free