(interpreter: tf.lite.Interpreter, tensor_idx)
| 7 | import msgpack |
| 8 | |
| 9 | def get_shape(interpreter: tf.lite.Interpreter, tensor_idx): |
| 10 | if tensor_idx == -1: |
| 11 | return [] |
| 12 | tensor = interpreter.get_tensor(tensor_idx) |
| 13 | return list(tensor.shape) |
| 14 | |
| 15 | def handle_numpy_or_literal(inp: Union[np.ndarray, Literal[0]]): |
| 16 | if isinstance(inp, int): |