/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/DilatedConvolutionUtils.h (6416B)
#pragma once #include #include #include #include #define TORCH_CHECK_DIM_SIZE(T, DIM, DIM_SIZE, SIZE) \ TORCH_CHECK( \ T.dim() == DIM && T.size(DIM_SIZE) == SIZE, \ "Need " #T " of dimension ", \ DIM, \ " and " #T ".size[", \ DIM_SIZE, \ "] == ", \ SIZE, \ " but got input to be of shape ", \ T.sizes()) namespace at { namespace native { namespace internal { namespace { inline bool all_positive(IntArrayRef& arr) { return std::all_of( arr.begin(), arr.end(), [](int64_t item) { return item > 0; }); } inline bool all_nonnegative(std::vector& arr) { return std::all_of( arr.begin(), arr.end(), [](int64_t item) { return item >= 0; }); } } // namespace // calculate the rear part of output tensor sizes template std::vector get_output_size( const Tensor& input, IntArrayRef kernel_size, IntArrayRef stride_size, IntArrayRef pad_size, IntArrayRef dilation_size) { std::vector sizes; for (int index = 0; index < dim; index++) { sizes.push_back( div_rtn( input.size(index + input.dim() - dim) + 2 * pad_size[index] - (dilation_size[index] * (kernel_size[index] - 1) + 1), stride_size[index]) + 1); } return sizes; } // calculate the sizes of output tensor template std::vector get_output_size( const Tensor& input, const Tensor& weight, IntArrayRef kernel_size, IntArrayRef stride_size, IntArrayRef pad_size, IntArrayRef dilation_size) { auto output_size = get_output_size( input, kernel_size, stride_size, pad_size, dilation_size); output_size.insert(output_size.begin(), weight.size(0)); if (input.dim() == dim + 2) { output_size.insert(output_size.begin(), input.size(0)); } return output_size; } /* slow_conv_dilated_shape_check - check user-input to dilated convolution forward and backward functions. */ template void slow_conv_dilated_shape_check( const Tensor& input, const Tensor& weight, const Tensor& bias, const Tensor& grad_output, IntArrayRef kernel_size, IntArrayRef stride_size, IntArrayRef pad_size, IntArrayRef dilation_size) { /* When the following tensors are defined: bias, grad_weight, grad_output then these are assumed to be contiguous without checking because of these tensors are made contiguous by calling .contiguous() method or by resizing of zero-sized tensors in forward/backward functions. When grad_weight is defined then it is assumed without checking to have the same shape as weight, see backward functions. */ // Check size arguments TORCH_CHECK( kernel_size.size() == dim, "kernel sizes length should be ", dim, ", but got ", kernel_size.size()); TORCH_CHECK( stride_size.size() == dim, "strides length should be ", dim, ", but got ", stride_size.size()); TORCH_CHECK( dilation_size.size() == dim, "dilations length should be ", dim, ", but got ", dilation_size.size()); TORCH_CHECK( pad_size.size() == dim, "pads length should be ", dim, ", but got ", pad_size.size()); TORCH_CHECK( all_positive(kernel_size), "kernel size should be greater than zero, but got ", kernel_size); TORCH_CHECK( all_positive(stride_size), "stride should be greater than zero, but got ", stride_size); TORCH_CHECK( all_positive(dilation_size), "dilation should be greater than zero, but got ", dilation_size); // check input TORCH_CHECK(input.defined(), "input must be defined"); bool is_batch = input.dim() == dim + 2; int64_t n = (is_batch ? 2 : 1); int64_t ndim = n + dim; if (!is_batch) { // input dim has to be dim + 1 if not batched TORCH_CHECK( input.dim() == dim + 1, "input must be 4D or 5D tensor but got ", input.dim(), "D tensor"); } // check output sizes auto output_size = get_output_size( input, kernel_size, stride_size, pad_size, dilation_size); TORCH_CHECK( all_nonnegative(output_size), "calculated output size ", output_size, " is too small (all sizes must be non-negative)"); // check weight TORCH_CHECK(weight.defined(), "weight must be defined"); TORCH_CHECK( weight.dim() == dim + 2, "weight must be ", dim + 2, "D tensor but got ", weight.dim(), "D tensor dim=", dim); TORCH_CHECK( weight.sizes().slice(2) == kernel_size, "weight[2:] shape ", weight.sizes().slice(2), " must be equal to kernel_size ", kernel_size); TORCH_CHECK_DIM_SIZE(input, input.dim(), (is_batch ? 1 : 0), weight.size(1)); // check bias when present if (bias.defined()) { TORCH_CHECK( bias.dim() == 1, "bias must be 1D tensor but got ", bias.dim(), "D tensor"); TORCH_CHECK_DIM_SIZE(bias, 1, 0, weight.size(0)); } // check grad_output when present if (grad_output.defined()) { TORCH_CHECK( grad_output.dim() == ndim, "grad_output must be ", ndim, "D tensor but got ", grad_output.dim(), "D tensor"); if (is_batch) { TORCH_CHECK( grad_output.size(0) == input.size(0), "grad_output.size(0)=", grad_output.size(0), " must be input.size(0)=", input.size(0)); } TORCH_CHECK( grad_output.size(n - 1) == weight.size(0), "grad_output.size(", n - 1, ")=", grad_output.size(n - 1), " must be weight.size(0)=", weight.size(0)); TORCH_CHECK( grad_output.sizes().slice(n) == output_size, "grad_output[", n, ":] shape", grad_output.sizes().slice(n), " must be equal to output size ", output_size); } } } // namespace internal } // namespace native } // namespace at