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

Function IsInnerDimsSizeAligned

tensorflow/core/framework/ops_util.h:49–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47// &tensor(i, ...)) is multiple of EIGEN_MAX_ALIGN_BYTES.
48template <typename T>
49bool IsInnerDimsSizeAligned(const TensorShape& s) {
50 if (s.dims() == 0) return false;
51 const int64 dim0_size = s.dim_size(0);
52 if (dim0_size == 0) return false;
53#if EIGEN_MAX_ALIGN_BYTES == 0
54 return true;
55#else
56 const int64 bytes_per_dim0 = (s.num_elements() / dim0_size) * sizeof(T);
57 return bytes_per_dim0 % EIGEN_MAX_ALIGN_BYTES == 0;
58#endif
59}
60
61// Given a shape 's' of a tensor of type T and the `start` and `end` index of a
62// dim 0 slice, returns true iff slice is aligned with respect to original

Callers

nothing calls this directly

Calls 3

dimsMethod · 0.45
dim_sizeMethod · 0.45
num_elementsMethod · 0.45

Tested by

no test coverage detected