tools/autograd/templates/Functions.cpp
// Returns the minimum storage size needed to contain a tensor of sizes, strides, and storage_offset
// Helper for as_strided_backward
Returns the minimum storage size needed to contain a tensor of sizes, strides, and storage_offset
Helper for as_strided_backward
Returns the minimum storage size needed to contain a tensor of sizes strides and storage_offset Helper for as_strided_backward
static inline int64_t _min_storage_size(IntList sizes, IntList strides, int64_t storage_offset) {
  int64_t storage_size = storage_offset + 1;
  int64_t dim = sizes.size();
  for (int64_t i = 0; i < dim; i++) {
    auto size_i = sizes[i];
    if (size_i == 0) {
      return storage_offset;
    }
    storage_size += (size_i - 1) * strides[i];
  }
  return storage_size;
}
static inline int64_t _min_storage_size ( IntList sizes , IntList strides , int64_t storage_offset ) { int64_t storage_size = storage_offset + 1 ; int64_t dim = sizes . size ( ) ; for ( int64_t i = 0 ; i < dim ; i ++ ) { auto size_i = sizes [ i ] ; if ( size_i == 0 ) { return storage_offset ; } storage_size += ( size_i - 1 ) * strides [ i ] ; } return storage_size ; }
Returns the minimum storage size needed to contain a tensor of sizes, strides, and storage_offset
Helper for as_strided_backward
Returns the minimum storage size needed to contain a tensor of sizes strides and storage_offset Helper for as_strided_backward