conv function

VARP conv(
  1. VARP x,
  2. VARP weight, {
  3. VARP? bias,
  4. PaddingMode pad = PaddingMode.VALID,
  5. List<int> stride = const [1, 1],
  6. List<int> dilatie = const [1, 1],
  7. int group = 1,
  8. List<int> pads = const [0, 0],
})

Implementation

VARP conv(
  VARP x,
  VARP weight, {
  VARP? bias,
  PaddingMode pad = PaddingMode.VALID,
  List<int> stride = const [1, 1],
  List<int> dilatie = const [1, 1],
  int group = 1,
  List<int> pads = const [0, 0],
}) {
  final (stridePtr, strideSize) = stride.toNativeArrayI32();
  final (dilationPtr, dilationSize) = dilatie.toNativeArrayI32();
  final (padPtr, padSize) = pads.toNativeArrayI32();
  final rval = VARP.fromPointer(
    C.mnn_expr_Conv(
      weight.ptr,
      bias?.ptr ?? ffi.nullptr,
      x.ptr,
      pad.value,
      stridePtr.cast(),
      strideSize,
      dilationPtr.cast(),
      dilationSize,
      group,
      padPtr.cast(),
      padSize,
    ),
  );
  calloc.free(stridePtr);
  calloc.free(dilationPtr);
  calloc.free(padPtr);
  return rval;
}