_resize_ Class — pytorch Architecture
Architecture documentation for the _resize_ class in Resize.cpp from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/Resize.cpp lines 232–254
template <typename T>
static const Tensor& _resize_(
const Tensor& self,
ArrayRef<T> size,
std::optional<MemoryFormat> optional_memory_format) {
auto* self_ = self.unsafeGetTensorImpl();
int64_t old_storage_nbytes = self_->unsafe_storage() ? self_->unsafe_storage().sym_nbytes().maybe_as_int().value_or(-1) : 0;
_resize_impl_<T>(self_, size, /*stride=*/std::nullopt, true);
if (optional_memory_format.has_value()) {
auto memory_format =
optional_memory_format.value();
TORCH_CHECK(
memory_format != MemoryFormat::Preserve,
"Unsupported memory format",
memory_format);
self_->empty_tensor_restride(memory_format);
}
// See Note [Enabling Deterministic Operations]
if (C10_UNLIKELY(at::globalContext().deterministicAlgorithms() && at::globalContext().deterministicFillUninitializedMemory() && old_storage_nbytes != -1)) {
at::native::fill_resize_deterministic_(self, old_storage_nbytes);
}
return self;
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free