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

Function SliceDebugString

tensorflow/core/util/util.cc:99–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99string SliceDebugString(const TensorShape& shape, const int64 flat) {
100 // Special case rank 0 and 1
101 const int dims = shape.dims();
102 if (dims == 0) return "";
103 if (dims == 1) return strings::StrCat("[", flat, "]");
104
105 // Compute strides
106 gtl::InlinedVector<int64, 32> strides(dims);
107 strides.back() = 1;
108 for (int i = dims - 2; i >= 0; i--) {
109 strides[i] = strides[i + 1] * shape.dim_size(i + 1);
110 }
111
112 // Unflatten index
113 int64 left = flat;
114 string result;
115 for (int i = 0; i < dims; i++) {
116 strings::StrAppend(&result, i ? "," : "[", left / strides[i]);
117 left %= strides[i];
118 }
119 strings::StrAppend(&result, "]");
120 return result;
121}
122
123#ifdef INTEL_MKL
124bool DisableMKL() {

Callers 10

DoScatterNdFunction · 0.85
operator()Method · 0.85
ComputeMethod · 0.85
DoComputeMethod · 0.85
DoComputeMethod · 0.85
ComputeMethod · 0.85
ComputeMethod · 0.85
ValidateIndicesMethod · 0.85
DoGatherNdFunction · 0.85

Calls 5

StrCatFunction · 0.50
StrAppendFunction · 0.50
dimsMethod · 0.45
backMethod · 0.45
dim_sizeMethod · 0.45

Tested by

no test coverage detected