CastOp constructor

CastOp(
  1. TfLiteType destinationType
)

Constructs a CastOp.

Note: For only converting type for a certain TensorBuffer on-the-fly rather than in a processor, please directly use TensorBuffer.createFrom(buffer, dataType).

When this Op is executed, if the original TensorBuffer is already in destinationType, the original buffer will be directly returned.

Throws ArgumentError if destinationType is neither TfLiteType.float32 nor TfLiteType.uint8.

Implementation

CastOp(TfLiteType destinationType) {
  SupportPreconditions.checkArgument(
      destinationType == TfLiteType.uint8 ||
          destinationType == TfLiteType.float32,
      errorMessage: "Destination Type " +
          destinationType.toString() +
          " is not supported");
  _destinationType = destinationType;
}