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

Function GetSliceIndex

tensorflow/core/util/sparse/sparse_tensor.h:337–348  ·  view source on GitHub ↗

Helper for Split() that returns the slice index.

Source from the content-addressed store, hash-verified

335
336 // Helper for Split() that returns the slice index.
337 static inline int GetSliceIndex(const int dim, const int split_size,
338 const int residual) {
339 DCHECK_GT(split_size, 0);
340 DCHECK_GE(dim, 0);
341 if (residual == 0) return dim / split_size;
342 const int offset = residual * (split_size + 1);
343 if (dim < offset) {
344 return dim / (split_size + 1);
345 } else {
346 return residual + ((dim - offset) / split_size);
347 }
348 }
349
350 // Helper for Split() that returns the dimension in the slice.
351 static inline int GetDimensionInSlice(const int dim, const int split_size,

Callers 1

SplitMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected