Build scalar tensor data range from min_value to max_value exclusively.
(dtype, min_value=-100, max_value=100)
| 257 | |
| 258 | |
| 259 | def 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 | |
| 272 | def freeze_graph(session, outputs): |