input<T extends SizedNativeType> function

VARP input<T extends SizedNativeType>(
  1. List<int> shape, {
  2. DimensionFormat dataFormat = DimensionFormat.NC4HW4,
})

create a input variable.

Args:

  • shape: A vector, the shape of the variable.
  • data_format: A enum, NCHW/NHWC/NC4HW4 is allowed.

Returns:

  • output: A variable.

Implementation

VARP input<T extends ffi.SizedNativeType>(
  List<int> shape, {
  DimensionFormat dataFormat = DimensionFormat.NC4HW4,
}) {
  MnnAssert(T != ffi.SizedNativeType, "You must specify the generic type T. e.g., mnn.float32");
  final (p, size) = shape.toNativeArrayI32();
  final rval = VARP.fromPointer(
    C.mnn_expr_Input(p.cast(), size, dataFormat.value, HalideType.of<T>().native.ref),
  );
  calloc.free(p);
  return rval;
}