MCPcopy Create free account
hub / github.com/NVIDIA/DALI / _check_data_batch

Function _check_data_batch

dali/python/nvidia/dali/external_source.py:52–69  ·  view source on GitHub ↗
(data, batch_size, layout)

Source from the content-addressed store, hash-verified

50
51
52def _check_data_batch(data, batch_size, layout):
53 shape, uniform = _get_batch_shape(data)
54 if len(shape) > batch_size:
55 raise RuntimeError(
56 f"The external source callback returned an unexpected batch "
57 f"size. Expected batch_size <= {batch_size}, actual: {len(shape)}"
58 )
59
60 if len(shape) > 0:
61 dim = len(shape[0])
62 if not uniform:
63 for ts in shape:
64 if len(ts) != dim:
65 raise RuntimeError(
66 "All tensors in a batch must have the same number of dimensions"
67 )
68 if layout is not None and layout != "" and dim != len(layout):
69 raise RuntimeError(f"The layout '{layout}' cannot describe {dim}-dimensional data")
70
71
72def _prep_data_for_feed_input(data, batch_size, layout, device_id=None):

Callers 1

Calls 1

_get_batch_shapeFunction · 0.85

Tested by

no test coverage detected