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

Function _get_shape

tensorflow/python/ops/special_math_ops.py:543–554  ·  view source on GitHub ↗

Like get_shape().as_list(), but explicitly queries the shape of a tensor if necessary to ensure that the returned value contains no unknown value.

(tensor)

Source from the content-addressed store, hash-verified

541
542
543def _get_shape(tensor):
544 """Like get_shape().as_list(), but explicitly queries the shape of a tensor
545 if necessary to ensure that the returned value contains no unknown value."""
546
547 shape = tensor.get_shape().as_list()
548 none_indices = [i for i, d in enumerate(shape) if d is None]
549 if none_indices:
550 # Query the shape if shape contains None values
551 shape_tensor = array_ops.shape(tensor)
552 for i in none_indices:
553 shape[i] = shape_tensor[i]
554 return shape
555
556
557def _total_size(shape_values):

Callers 1

_einsum_reductionFunction · 0.70

Calls 3

as_listMethod · 0.45
get_shapeMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected