getVariableTensor method

Tensor getVariableTensor(
  1. int index
)

Gets the variable (trainable) tensor at the given index.

Implementation

Tensor getVariableTensor(int index) {
  checkState(
    !_deleted,
    message: 'Should not access interpreter after it has been closed.',
  );
  final count = getVariableTensorCount();
  if (index < 0 || index >= count) {
    throw ArgumentError('Invalid variable Tensor index: $index');
  }
  return Tensor(
    tfliteBinding.TfLiteInterpreterGetVariableTensor(_interpreter, index),
  );
}