getInputShapeIfDifferent method
Implementation
List<int>? getInputShapeIfDifferent(Object? input) {
if (input == null) return null;
if (input is ByteBuffer || input is Uint8List) return null;
if (input is TypedData && input is List) {
// Same decision as list_utils.getInputShapeIfDifferent for flat typed
// data, but derives the element count from the tensor's byte size
// instead of materializing the shape list, which costs NumDims plus
// one Dim FFI call per axis on every run.
final elementSize = _fixedElementByteSize(type);
if (elementSize > 0) {
final length = (input as List).length;
if (length * elementSize ==
tfliteBinding.TfLiteTensorByteSize(_tensor)) {
return null;
}
return [length];
}
}
return list_utils.getInputShapeIfDifferent(input, shape);
}