slow_conv2d_update_output_frame Class — pytorch Architecture
Architecture documentation for the slow_conv2d_update_output_frame class in ConvolutionMM2d.cpp from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/ConvolutionMM2d.cpp lines 222–284
template <typename scalar_t>
void slow_conv2d_update_output_frame(
TensorAccessor<const scalar_t, 3> input,
TensorAccessor<scalar_t, 3> output,
TensorAccessor<const scalar_t, 2> weight,
bool has_bias,
TensorAccessor<scalar_t, 2> finput,
int64_t kernel_height,
int64_t kernel_width,
int64_t stride_height,
int64_t stride_width,
int64_t pad_height,
int64_t pad_width,
int64_t n_input_plane,
int64_t input_height,
int64_t input_width,
int64_t n_output_plane,
int64_t output_height,
int64_t output_width,
bool is_channels_last) {
const int beta = has_bias ? 1 : 0;
// Compute out = weight * input
// Note gemm expects fortran order, so all 3 matrices are transposed.
// Swapping argument order cancels this, since C == AB <=> T(C) == T(B)T(A)
if (is_channels_last) {
const int64_t m = n_output_plane;
const int64_t n = output_height * output_width;
const int64_t k = n_input_plane * kernel_height * kernel_width;
const int64_t lda = k;
const int64_t ldb = k;
const int64_t ldc = m;
at::native::cpublas::gemm(
TransposeType::Transpose,
TransposeType::NoTranspose,
m, n, k,
static_cast<scalar_t>(1),
weight.data(), lda,
finput.data(), ldb,
static_cast<scalar_t>(beta),
output.data(), ldc);
} else {
const int64_t m = output_height * output_width;
const int64_t n = n_output_plane;
const int64_t k = n_input_plane * kernel_height * kernel_width;
const int64_t lda = m;
const int64_t ldb = k;
const int64_t ldc = m;
at::native::cpublas::gemm(
TransposeType::NoTranspose,
TransposeType::NoTranspose,
m, n, k,
static_cast<scalar_t>(1),
finput.data(), lda,
weight.data(), ldb,
static_cast<scalar_t>(beta),
output.data(), ldc);
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free