Skip to content

0.4.0

Latest

Choose a tag to compare

@github-actions github-actions released this 18 Nov 02:07
· 2 commits to main since this release

Added

  • Extractor::extract_mat returns an output as an independently owned Mat without copying it:
    the native extractor already detaches the tensor from its own blob pool, and this form takes that
    buffer instead of duplicating it. OutputGuard::into_mat is the same form through a scoped guard,
    and extract_mat with TensorWidth::Stored uses it for stored storage.
  • api_benchmark gained the owned-mat, guard-into, native-buffer and native-owned modes.
  • A raw feature exposes the generated bindings as ncnn_rust::sys. The default build no longer
    publishes them, so the crate's default surface carries no generated C ABI.
  • Prebuilt SDK archives on the sdk-20261020 release: one shared-library
    ncnn-rust-sdk-20261020-<platform>.tar.gz each for linux-x64-cpu, linux-x64-vulkan,
    windows-x64-cpu and macos-arm64-cpu, next to a SHA256SUMS file. tools/install-sdk.py
    installs one and checks it against that digest and against the release stamped in
    include/ncnn/platform.h, so a machine needs neither CMake, glslang nor a C++ build of ncnn, and
    --list prints the platform names.

Changed

  • extract_mat with either width and OutputGuard::into_mat copy only when the storage cannot be owned: a
    network built with NetBuilder::reuse_blob_memory returns tensors inside its pools, and an
    extractor that submitted a borrowed input returns caller storage.
  • The native request reference in api_benchmark now runs the options each wrapper row uses
    (native-request borrows its input and keeps light mode off, the owned variants enable it) and
    releases its input handle before the request. The request-path figures in the performance page were
    measured again: the wrapper matches the C API on every form that borrows or reuses its output, and
    the forms that return copied storage cost one or two 256 KB buffers per request.
  • The request forms collapse onto one storage decision per side. extract and extract_mat take a
    TensorWidth, so FP32 and stored width no longer need separate methods, and extract_into appends
    rather than replaces, so the separate append form is gone. On Net, infer, infer_stored and
    infer_into take an Input, which folds the owned, borrowed-slice and sub-view forms into them.
    The extractor request surface drops from eight methods to four and the network from six to three,
    and no capability is lost.
  • Extractor::extract_owned is now the sugar form of extract_into: it allocates the vector and
    delegates, so the FP32 conversion has one implementation instead of two.
  • The loading methods take a source instead of a parameter shape. load_param accepts
    ParamSource::{Text, Binary, File, Reader}, load_model accepts
    WeightSource::{Bytes, File, Reader} plus WeightSource::EMPTY, and Net::load runs both stages
    in one call. From conversions keep load_param("…") and load_model(&bytes) unchanged.

Removed

  • Extractor::extract_stored, Extractor::extract_stored_owned, Extractor::extract_append,
    Net::infer_borrowed, Net::infer_borrowed_into and Net::infer_view_into, replaced by the
    TensorWidth and Input arguments that docs/migration.md maps from the old names.
  • Extractor::inputs and Extractor::outputs_with, which only looped over input and extract;
    the caller writes that loop and keeps the error policy visible.
  • OutputGuard::detach, the copying twin of into_mat: into_mat already copies when it cannot
    own the storage, so the guard keeps one ownership path.
  • Net::load_param_file, Net::load_param_binary, Net::load_param_reader, Net::load_model_file
    and Net::load_model_reader. Their capability moves into ParamSource and WeightSource, which
    also removes the four near-identical parameter loaders and the three weight loaders.
    Net::load_model_file_native stays separate because mapped loading changes the lifetime contract.
  • Mat::append_f32_to, whose behaviour Mat::to_f32_into now has: it appends, leaves the vector
    untouched on failure, and keeps the capacity, so the replace form was the special case a caller
    writes with clear().
  • Mat::read_f32_unchecked, which ran the same validation and the same native copy as Mat::to_f32:
    an unsafe marker promised nothing the safe form does not already do, so to_f32 is the only
    FP32 copy.
  • PoolAllocator, which is now alloc::Pool: the crate carried two types called Allocator (the
    CPU pool and gpu::Allocator), and the per-extractor and option setters read ambiguously.