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

Method resize_tensor_input

tensorflow/lite/python/interpreter.py:348–363  ·  view source on GitHub ↗

Resizes an input tensor. Args: input_index: Tensor index of input to set. This value can be gotten from the 'index' field in get_input_details. tensor_size: The tensor_shape to resize the input to. Raises: ValueError: If the interpreter could not resize

(self, input_index, tensor_size)

Source from the content-addressed store, hash-verified

346 self._interpreter.SetTensor(tensor_index, value)
347
348 def resize_tensor_input(self, input_index, tensor_size):
349 """Resizes an input tensor.
350
351 Args:
352 input_index: Tensor index of input to set. This value can be gotten from
353 the 'index' field in get_input_details.
354 tensor_size: The tensor_shape to resize the input to.
355
356 Raises:
357 ValueError: If the interpreter could not resize the input tensor.
358 """
359 self._ensure_safe()
360 # `ResizeInputTensor` now only accepts int32 numpy array as `tensor_size
361 # parameter.
362 tensor_size = np.array(tensor_size, dtype=np.int32)
363 self._interpreter.ResizeInputTensor(input_index, tensor_size)
364
365 def get_output_details(self):
366 """Gets model output details.

Callers 1

testUint8Method · 0.95

Calls 2

_ensure_safeMethod · 0.95
ResizeInputTensorMethod · 0.45

Tested by 1

testUint8Method · 0.76