squeeze function

VARP squeeze(
  1. VARP input, {
  2. List<int> axis = const [],
})

Removes dimensions of size 1 from the shape of a variable.

Args:

  • input: A variable. The input to squeeze.
  • axis: A vector, Defaults to {}. If specified, only squeezes the dimensions listed. The dimension index starts at 0. Must be in the range [-rank(input), rank(input)).

Returns:

  • A variable. Has the same type as input. Contains the same data as input, but has one or more dimensions of size 1 removed.

Implementation

VARP squeeze(VARP input, {List<int> axis = const []}) {
  final (axisPtr, axisSize) = axis.toNativeArrayI32();
  final rval = VARP.fromPointer(C.mnn_expr_Squeeze(input.ptr, axisPtr.cast(), axisSize));
  calloc.free(axisPtr);
  return rval;
}