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

Function reallocate

tensorflow/contrib/metrics/python/ops/metric_ops.py:3639–3650  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3637 batch_values = array_ops.transpose(values, perm)[:batch_size]
3638
3639 def reallocate():
3640 next_size = _next_array_size(new_size)
3641 next_shape = array_ops.stack([next_size] + fixed_shape)
3642 new_value = array_ops.zeros(next_shape, dtype=values.dtype)
3643 old_value = array.value()
3644 with ops.control_dependencies([old_value]):
3645 assign_op = state_ops.assign(array, new_value, validate_shape=False)
3646 with ops.control_dependencies([assign_op]):
3647 copy_op = array[:size].assign(old_value[:size])
3648 # return value needs to be the same dtype as no_op() for cond
3649 with ops.control_dependencies([copy_op]):
3650 return control_flow_ops.no_op()
3651
3652 new_size = size + batch_size
3653 array_size = array_ops.shape_internal(array, optimize=False)[0]

Callers

nothing calls this directly

Calls 5

_next_array_sizeFunction · 0.85
stackMethod · 0.45
valueMethod · 0.45
control_dependenciesMethod · 0.45
assignMethod · 0.45

Tested by

no test coverage detected