MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CalculateStrides

Function CalculateStrides

tensorflow/core/kernels/where_op_gpu.cu.h:255–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253
254template <typename TIndex, typename T, int NDIM>
255Eigen::array<TIndex, NDIM> CalculateStrides(
256 typename TTypes<T, NDIM>::ConstTensor input) {
257 const Eigen::DSizes<Eigen::DenseIndex, NDIM> dims = input.dimensions();
258 Eigen::array<TIndex, NDIM> strides;
259 EIGEN_STATIC_ASSERT((static_cast<int>(decltype(input)::Layout) ==
260 static_cast<int>(Eigen::RowMajor)),
261 INTERNAL_ERROR_INPUT_SHOULD_BE_ROWMAJOR);
262 strides[NDIM - 1] = 1;
263 for (int i = NDIM - 2; i >= 0; --i) {
264 strides[i] = strides[i + 1] * dims[i + 1];
265 }
266 return strides;
267}
268
269template <int NDIM, typename T, typename TIndex>
270struct Where<GPUDevice, NDIM, T, TIndex> {

Callers

nothing calls this directly

Calls 1

dimensionsMethod · 0.45

Tested by

no test coverage detected