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

Function create_scalar_data

tensorflow/lite/testing/generate_examples_lib.py:259–269  ·  view source on GitHub ↗

Build scalar tensor data range from min_value to max_value exclusively.

(dtype, min_value=-100, max_value=100)

Source from the content-addressed store, hash-verified

257
258
259def create_scalar_data(dtype, min_value=-100, max_value=100):
260 """Build scalar tensor data range from min_value to max_value exclusively."""
261
262 if dtype in TF_TYPE_INFO:
263 dtype = TF_TYPE_INFO[dtype][0]
264
265 if dtype in (tf.float32, tf.float16):
266 value = (max_value - min_value) * np.random.random() + min_value
267 elif dtype in (tf.int32, tf.uint8, tf.int64, tf.int16):
268 value = np.random.randint(min_value, max_value + 1)
269 return np.array(value, dtype=dtype)
270
271
272def freeze_graph(session, outputs):

Callers 1

build_inputsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected