/usr/local/lib64/python3.6/site-packages/torch/include/ATen/native
NameSizeModeActions
cpu/-0755rm
cuda/-0755rm
quantized/-0755rm
Activation.h30690644editdlrm
AdaptivePooling.h11650644editdlrm
BatchLinearAlgebra.h82460644editdlrm
batch_norm.h12850644editdlrm
BinaryOps.h49160644editdlrm
BucketizationUtils.h42480644editdlrm
ComplexHelper.h37970644editdlrm
CompositeRandomAccessor.h8880644editdlrm
CompositeRandomAccessorCommon.h67130644editdlrm
ConvUtils.h53500644editdlrm
Copy.h3560644editdlrm
CPUBlas.h41990644editdlrm
CPUFallback.h24040644editdlrm
Cross.h2620644editdlrm
DilatedConvolutionUtils.h64160644editdlrm
DispatchStub.h76720644editdlrm
Distance.h7320644editdlrm
Distributions.h216540644editdlrm
DistributionTemplates.h186230644editdlrm
EmbeddingBag.h13200644editdlrm
Fill.h3840644editdlrm
ForeachUtils.h59620644editdlrm
FunctionOfAMatrixUtils.h4360644editdlrm
GridSampler.h105250644editdlrm
group_norm.h8960644editdlrm
Histogram.h4920644editdlrm
im2col.h28380644editdlrm
im2col_shape_check.h61810644editdlrm
IndexingUtils.h53730644editdlrm
layer_norm.h28920644editdlrm
Lerp.h5530644editdlrm
LinearAlgebra.h6030644editdlrm
LinearAlgebraUtils.h252360644editdlrm
LossMulti.h21970644editdlrm
Math.h913560644editdlrm
MathBitFallThroughLists.h40860644editdlrm
MathBitsFallback.h73260644editdlrm
MaxPooling.h12340644editdlrm
Normalization.h3020644editdlrm
PointwiseOps.h7490644editdlrm
Pool.h109220644editdlrm
Pow.h16940644editdlrm
ReduceAllOps.h3780644editdlrm
ReduceOps.h17450644editdlrm
ReduceOpsUtils.h122450644editdlrm
Repeat.h12860644editdlrm
Resize.h65010644editdlrm
ResizeCommon.h13210644editdlrm
RNN.h24670644editdlrm
ScatterGatherChecks.h36410644editdlrm
SegmentReduce.h6850644editdlrm
SharedReduceOps.h157850644editdlrm
SobolEngineOpsUtils.h17230644editdlrm
Sorting.h5360644editdlrm
SortingUtils.h57220644editdlrm
SpectralOpsUtils.h31460644editdlrm
StridedRandomAccessor.h68470644editdlrm
TensorAdvancedIndexing.h30720644editdlrm
TensorCompare.h13330644editdlrm
TensorDimApply.h18320644editdlrm
TensorFactories.h33820644editdlrm
TensorIterator.h460644editdlrm
TensorIteratorDynamicCasting.h20250644editdlrm
TensorShape.h10490644editdlrm
TensorTransformations.h9380644editdlrm
TriangularOpsUtils.h20000644editdlrm
TypeProperties.h4960644editdlrm
UnaryOps.h44640644editdlrm
Unfold2d.h5510644editdlrm
Unfold3d.h8520644editdlrm
UnfoldBackward.h53980644editdlrm
UpSample.h135990644editdlrm
vol2col.h36420644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/include/ATen/native/im2col_shape_check.h (6181B)
#include #include namespace at { namespace native { static inline void col2im_shape_check( const Tensor& input, const Tensor& grad_output, int64_t output_height, int64_t output_width, int64_t kernel_height, int64_t kernel_width, int64_t dilation_height, int64_t dilation_width, int64_t pad_height, int64_t pad_width, int64_t stride_height, int64_t stride_width) { TORCH_CHECK( kernel_width > 0 && kernel_height > 0, "kernel size should be greater than zero, but got kernel_height: ", kernel_height, " kernel_width: ", kernel_width); TORCH_CHECK( stride_width > 0 && stride_height > 0, "stride should be greater than zero, but got stride_height: ", stride_height, " stride_width: ", stride_width); TORCH_CHECK( dilation_width > 0 && dilation_height > 0, "dilation should be greater than zero, but got dilation_height: ", dilation_height, " dilation_width: ", dilation_width); int64_t ndim = input.ndimension(); // allow dim=0 only the batch dimension. TORCH_CHECK( (ndim == 2 && input.size(0) != 0 && input.size(1) != 0) || (ndim == 3 && input.size(1) != 0 && input.size(2) != 0), "Expected 2D or 3D (batch mode) tensor for input with possibly 0 batch size and non-zero dimensions for input, but got: ", input.sizes()); int64_t batch_dim = (ndim == 3) ? 0 : -1; int64_t n_input_plane = input.size(batch_dim + 1); if (n_input_plane % (kernel_width * kernel_height) != 0) { AT_ERROR( "Expected size of input's dimension 1 to be divisible by the " "product of kernel_size, but got input.size(1)=", n_input_plane, " and kernel_size=(", kernel_height, ", ", kernel_width, ")."); } int64_t input_length = input.size(batch_dim + 2); int64_t n_blocks_height = div_rtn( output_height + 2 * pad_height - dilation_height * (kernel_height - 1) - 1, stride_height) + 1; int64_t n_blocks_width = div_rtn( output_width + 2 * pad_width - dilation_width * (kernel_width - 1) - 1, stride_width) + 1; if (input_length != (n_blocks_height * n_blocks_width)) { AT_ERROR( "Given output_size=(", output_height, ", ", output_width, "), kernel_size=(", kernel_height, ", ", kernel_width, "), dilation=(", dilation_height, ", ", dilation_width, "), padding=(", pad_height, ", ", pad_width, "), stride=(", stride_height, ", ", stride_width, "), expected size of input's dimension 2 to match the calculated number of ", "sliding blocks ", n_blocks_height, " * ", n_blocks_width, " = ", (n_blocks_height * n_blocks_width), ", but got input.size(2)=", input_length, "."); } if (output_width < 1 || output_height < 1) { AT_ERROR( "Expected output spatial size to be positive, but got: output_size=(", output_height, ", ", output_width, ")."); } } static inline void im2col_shape_check( const Tensor& input, const Tensor& grad_output, int64_t kernel_height, int64_t kernel_width, int64_t dilation_height, int64_t dilation_width, int64_t pad_height, int64_t pad_width, int64_t stride_height, int64_t stride_width) { TORCH_CHECK( kernel_width > 0 && kernel_height > 0, "kernel size should be greater than zero, but got kernel_height: ", kernel_height, " kernel_width: ", kernel_width); TORCH_CHECK( dilation_width > 0 && dilation_height > 0, "dilation should be greater than zero, but got dilation_height: ", dilation_height, " dilation_width: ", dilation_width); TORCH_CHECK( pad_width >= 0 && pad_height >= 0, "padding should be non-negative, but got pad_height: ", pad_height, " pad_width: ", pad_width); TORCH_CHECK( stride_width > 0 && stride_height > 0, "stride should be greater than zero, but got stride_height: ", stride_height, " stride_width: ", stride_width); int64_t ndim = input.ndimension(); // allow dim=0 only the batch dimension. bool valid_dims = input.size(1) != 0 && input.size(2) != 0; TORCH_CHECK( (ndim == 3 && input.size(0) && valid_dims) || (ndim == 4 && valid_dims && input.size(3) != 0), "Expected 3D or 4D (batch mode) tensor with possibly 0 batch size and other non-zero dimensions for input, but got: ", input.sizes()); int64_t dim_batch = 0; if (ndim == 3) { dim_batch = -1; } int64_t input_height = input.size(dim_batch + 2); int64_t input_width = input.size(dim_batch + 3); int64_t output_height = div_rtn( input_height + 2 * pad_height - (dilation_height * (kernel_height - 1) + 1), stride_height) + 1; int64_t output_width = div_rtn( input_width + 2 * pad_width - (dilation_width * (kernel_width - 1) + 1), stride_width) + 1; if (output_height < 1 || output_width < 1) { AT_ERROR( "Given input with spatial size (", input_height, ", ", input_height, "), kernel_size=(", kernel_height, ", ", kernel_width, "), dilation=(", dilation_height, ", ", dilation_width, "), padding=(", pad_height, ", ", pad_width, "), calculated shape of the array of sliding blocks as (", output_height, ", ", output_width, "), which is too small (non-positive)."); } } } // namespace native } // namespace at