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

Function format_result

tensorflow/lite/testing/generate_examples_lib.py:160–167  ·  view source on GitHub ↗

Convert a tensor to a format that can be used in test specs.

(t)

Source from the content-addressed store, hash-verified

158
159
160def format_result(t):
161 """Convert a tensor to a format that can be used in test specs."""
162 if t.dtype.kind not in [np.dtype(np.string_).kind, np.dtype(np.object_).kind]:
163 # Output 9 digits after the point to ensure the precision is good enough.
164 values = ["{:.9f}".format(value) for value in list(t.flatten())]
165 return ",".join(values)
166 else:
167 return string_util_wrapper.SerializeAsHexString(t.flatten())
168
169
170def write_examples(fp, examples):

Callers 2

write_tensorFunction · 0.85
write_test_casesFunction · 0.85

Calls 4

dtypeMethod · 0.45
formatMethod · 0.45
flattenMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected