sessionGetOutputName method

Pointer<OrtStatus> sessionGetOutputName(
  1. Pointer<OrtSession> session,
  2. int index,
  3. Pointer<Pointer<Char>> out
)

Implementation

Pointer<OrtStatus> sessionGetOutputName(
  Pointer<OrtSession> session,
  int index,
  Pointer<Pointer<Char>> out,
) {
  final getFn =
      SessionGetOutputName.asFunction<
        Pointer<OrtStatus> Function(
          Pointer<OrtSession>,
          int,
          Pointer<OrtAllocator>,
          Pointer<Pointer<Char>>,
        )
      >();
  final allocator = calloc<Pointer<OrtAllocator>>();
  getAllocatorWithDefaultOptions(allocator);
  final status = getFn(session, index, allocator.value, out);
  calloc.free(allocator);
  if (status.isError) {
    final error =
        'Code: ${getErrorCodeMessage(status)}\n'
        'Message: ${consumeErrorMessage(status)}';
    throw Exception(error);
  }
  return status;
}