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

Method set_tensor

tensorflow/lite/python/interpreter.py:332–346  ·  view source on GitHub ↗

Sets the value of the input tensor. Note this copies data in `value`. If you want to avoid copying, you can use the `tensor()` function to get a numpy buffer pointing to the input buffer in the tflite interpreter. Args: tensor_index: Tensor index of tensor to set. This value can

(self, tensor_index, value)

Source from the content-addressed store, hash-verified

330 ]
331
332 def set_tensor(self, tensor_index, value):
333 """Sets the value of the input tensor. Note this copies data in `value`.
334
335 If you want to avoid copying, you can use the `tensor()` function to get a
336 numpy buffer pointing to the input buffer in the tflite interpreter.
337
338 Args:
339 tensor_index: Tensor index of tensor to set. This value can be gotten from
340 the 'index' field in get_input_details.
341 value: Value of tensor to set.
342
343 Raises:
344 ValueError: If the interpreter could not set the tensor.
345 """
346 self._interpreter.SetTensor(tensor_index, value)
347
348 def resize_tensor_input(self, input_index, tensor_size):
349 """Resizes an input tensor.

Callers 15

testScalarValidMethod · 0.95
_evaluateTFLiteModelMethod · 0.95
testScalarValidMethod · 0.95
testSequentialModelMethod · 0.95
testCustomLayerMethod · 0.95
testFunctionalModelMethod · 0.95
testFloatMethod · 0.95
testUint8Method · 0.95
testStringMethod · 0.95

Calls 1

SetTensorMethod · 0.45

Tested by 15

testScalarValidMethod · 0.76
_evaluateTFLiteModelMethod · 0.76
testScalarValidMethod · 0.76
testSequentialModelMethod · 0.76
testCustomLayerMethod · 0.76
testFunctionalModelMethod · 0.76
testFloatMethod · 0.76
testUint8Method · 0.76
testStringMethod · 0.76