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

Function _with_nonzero_rank

tensorflow/python/ops/array_ops.py:4973–4983  ·  view source on GitHub ↗

If `data` is scalar, then add a dimension; otherwise return as-is.

(data)

Source from the content-addressed store, hash-verified

4971
4972
4973def _with_nonzero_rank(data):
4974 """If `data` is scalar, then add a dimension; otherwise return as-is."""
4975 if data.shape.ndims is not None:
4976 if data.shape.ndims == 0:
4977 return stack([data])
4978 else:
4979 return data
4980 else:
4981 data_shape = shape(data)
4982 data_ndims = rank(data)
4983 return reshape(data, concat([[1], data_shape], axis=0)[-data_ndims:])
4984
4985
4986@tf_export("repeat")

Callers 1

repeat_with_axisFunction · 0.85

Calls 5

stackFunction · 0.70
shapeFunction · 0.70
rankFunction · 0.70
reshapeFunction · 0.70
concatFunction · 0.70

Tested by

no test coverage detected