Returns a Shape that describes a tuple-tree of Numpy arrays.
(pyval)
| 430 | |
| 431 | |
| 432 | def shape_from_pyval(pyval): |
| 433 | """Returns a Shape that describes a tuple-tree of Numpy arrays.""" |
| 434 | |
| 435 | def convert(pyval): |
| 436 | if isinstance(pyval, tuple): |
| 437 | return Shape.tuple_shape(tuple(convert(elt) for elt in pyval)) |
| 438 | else: |
| 439 | return Shape.array_shape(pyval.dtype, np.shape(pyval)) |
| 440 | |
| 441 | return convert(pyval) |
| 442 | |
| 443 | |
| 444 | def transfer_to_infeed(value, device=None): |
no test coverage detected