(data, is_batched)
| 360 | |
| 361 | # TODO(klecki): Maybe keep this data here instead of doing the copy twice |
| 362 | def _inspect_data(data, is_batched): |
| 363 | # TODO(klecki): Add asserts for uniform input batches (as well as output batches) |
| 364 | if is_batched: |
| 365 | as_numpy = batch_to_numpy(data, _tf_batch_error_msg, non_uniform_str=_tf_uniform_error_msg) |
| 366 | if isinstance(as_numpy, list): |
| 367 | return as_numpy[0].dtype, (None,) * (as_numpy[0].ndim + 1) |
| 368 | else: |
| 369 | return as_numpy.dtype, (None,) * as_numpy.ndim |
| 370 | else: |
| 371 | as_numpy = sample_to_numpy(data, _tf_sample_error_msg) |
| 372 | return as_numpy.dtype, (None,) * as_numpy.ndim |
| 373 | |
| 374 | |
| 375 | def get_batch_iterable_from_callback(source_desc: SourceDescription): |
no test coverage detected