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

Function check_inner_shape

tensorflow/python/ops/ragged/ragged_factory_ops.py:288–297  ·  view source on GitHub ↗

Checks that `item` has a consistent shape matching `shape`.

(item, shape)

Source from the content-addressed store, hash-verified

286 return (0,)
287
288 def check_inner_shape(item, shape):
289 """Checks that `item` has a consistent shape matching `shape`."""
290 is_nested = isinstance(item, (list, tuple)) or np.ndim(item) != 0
291 if is_nested != bool(shape):
292 raise ValueError("inner values have inconsistent shape")
293 if is_nested:
294 if shape[0] != len(item):
295 raise ValueError("inner values have inconsistent shape")
296 for child in item:
297 check_inner_shape(child, shape[1:])
298
299 # Collapse the ragged layers to get the list of inner values.
300 flat_values = pylist

Callers 1

Calls 1

ndimMethod · 0.45

Tested by

no test coverage detected