:github_url: https://github.com/pytorch/pytorch .. _program_listing_file_aten_src_ATen_cudnn_Utils.h: Program Listing for File Utils.h ================================ |exhale_lsh| :ref:`Return to documentation for file ` (``aten/src/ATen/cudnn/Utils.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #pragma once #include #include #include #include namespace at::native { // cuDNN has a buggy check for tensor being contiguous (that is, it does // not ignore stride for dimension that is equal to 0). This function // makes tensors which have zero stride contiguous, by setting the // strides to 1 as cuDNN likes. inline Tensor contiguousIfZeroInStrides(const Tensor& t) { for (auto s : t.strides()) { if (s == 0) return t.contiguous(); } return t; } } // namespace at::native