ConvertConvWeightsToChannelLastTensor Class — pytorch Architecture
Architecture documentation for the ConvertConvWeightsToChannelLastTensor class in fbgemm_utils.cpp from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/quantized/cpu/fbgemm_utils.cpp lines 303–323
template <>
Tensor ConvertConvWeightsToChannelLastTensor<2>(
const at::Tensor& src,
int groups,
bool transpose) {
return transpose ?
// 2D conv transpose weight transform
// IC OC/G KH KW -> G OC/G KH KW IC/G
[&]() {
auto ic_g_oc_g_hw_tensors = src.chunk(groups);
for (auto& tensor : ic_g_oc_g_hw_tensors) {
tensor = tensor.unsqueeze(0);
}
auto fused_tensor = at::cat(ic_g_oc_g_hw_tensors);
set_quantizer_(fused_tensor, src.quantizer());
return fused_tensor.permute({0, 2, 3, 4, 1})
.contiguous(c10::MemoryFormat::Contiguous);
}()
// 2d conv weight transform
: src.contiguous(c10::MemoryFormat::ChannelsLast);
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free