Commit Graph

60 Commits

Author SHA1 Message Date
Carson M.
98519baca8 refactor!: flatten operator module 2026-01-15 02:21:04 -06:00
Carson M.
2650caa43c refactor!: flatten session module 2026-01-15 02:18:17 -06:00
Carson M.
25a6760783 refactor: merge tensor module into value 2026-01-15 02:03:23 -06:00
Carson M.
b6dd8565e6 refactor: hold onto MemoryInfo in Allocator 2025-12-28 19:11:09 -06:00
Carson M.
38573e0529 refactor: simplify ThreadManager 2025-12-23 16:45:52 -06:00
Carson M.
98703f16cf refactor!: unify session/node/operator outlets 2025-12-13 14:11:31 -06:00
Carson M.
e6fe5bffc1 fix: use locally stored imagenet classes 2025-11-16 20:49:43 -06:00
Carson M.
3b408b1b44 refactor: shorten execution_providers
frankly, working on documentation has made me tired of typing out `execution_providers` and `ExecutionProvider` all the time
2025-11-14 23:57:09 -06:00
Carson M.
75d43518bd chore: use 2024 edition Rust 2025-10-25 15:39:24 -05:00
Carson M.
c162a72a38 test: create session so env is initialized 2025-08-31 19:45:05 -05:00
Carson M.
317be209b1 fix: let Environment drop, closes #441
Let it die, let it die! You shall die

Instead of creating an environment that lives throughout the duration of the process, we now hold the environment options we commit, and create the environment from those options (or grab the current env) whenever we need it. When all holders of the environment are dropped, the environment is dropped as well.

Previously, we held `Environment` as a static variable. Statics are never dropped, but ONNX Runtime's own destructors assumes that the environment is long gone by the time the process exits, which was not the case in `ort`! This led to issues like #441 and the dumb `0003-leak-logger-mutex.patch` from `ort-artifacts`.
2025-08-31 18:57:38 -05:00
Carson M.
d269461e21 refactor!: make metadata methods return Option<T>
The only error case occurs when the value is not present, so `Option<T>`s make more sense here.
2025-08-14 16:42:10 -05:00
Carson M.
317d64bd70 feat: add back usize constructors for Shape, ref #370 2025-03-27 10:53:53 -05:00
Carson M.
750f1df136 tests: add valgrind sample program 2025-03-22 23:44:02 -05:00
Carson M.
072e162ce0 refactor!: rename extract_tensor -> extract_array, extract_raw_tensor -> extract_tensor
...and `extract_raw_map` to `extract_key_values`, but nobody cares about that
2025-03-20 00:44:15 -05:00
Carson M.
f1e7fe9d32 chore: silence, clippy 2025-03-20 00:24:05 -05:00
Carson M.
fccbf4daf7 chore: reduce dev dependencies 2025-03-17 01:00:33 -05:00
Carson M.
909e41f26a refactor!: opaque tensor shape, rename dimensions to shape 2025-03-12 22:28:18 -05:00
Carson M.
d738b1757b chore: start moving stuff off parcel 2025-02-21 23:31:14 -06:00
Carson M.
cae6ea847a chore: upgrade ureq to v3.0 2025-02-13 18:19:12 -06:00
Carson M.
bd2aff711e refactor!: make Session::run take &mut self 2025-02-08 11:56:51 -06:00
Carson M.
794c04190e chore: cleanup 2024-12-26 17:05:33 -06:00
Carson M.
9ea18d815b refactor!: allow zero-copy from_array for array views with TensorRef
This has all sorts of fun breaking changes:
- `ort::inputs!` no longer yields an `ort::Result<...>` (thank God)
- `Tensor::from_array` now only accepts owned data.
- Introduce `TensorRef::from_array_view` and `TensorRefMut::from_array_view_mut`.
- `TryFrom<A>` is no longer implemented for `Tensor<T>` for any variants.

This opens the door to new optimizations on top of fixing a few unsoundness issues.

TODO: update docs
2024-12-21 00:24:54 -06:00
Carson M.
0761362f99 fix: remove session thread manager test for now
Works on my machine, not sure why it doesn't in CI. Maybe due to the different # of cores (cause I'm not sure why 4 inter + 2 intra threads = 4 in the global test...)

The global test uses the exact same API so it should be fine to remove the session test.
2024-11-18 19:46:39 -06:00
Carson M.
87577ef396 feat: many a feature
I did that thing again!

Features in this commit:
- `ThreadManager` allows you to define custom thread creation functions for environments & sessions.
- Sessions can now opt-out of using the environment's global thread pool.
- Implemented the safe `ShapeInferenceContext` wrapper for custom operators.
- Prepacked weights allow the CPU execution provider to share one allocation for identical weights between sessions.
- Customize workload type to prioritize efficiency; useful for background tasks.
- Configurable per-session log identifiers
- Dynamic dimension overrides

Breaking changes:
- `EnvironmentGlobalThreadPoolOptions` is now `GlobalThreadPoolOptions` and uses the builder pattern instead of exposed struct fields.
2024-11-18 19:38:59 -06:00
Carson M.
d4f82fc50e refactor!: undo The Flattening 2024-11-12 22:19:15 -06:00
Carson M.
5b2983e210 feat: tests for adapter API 2024-11-04 16:50:15 -06:00
Carson M.
cdd6be7a66 chore(*): format code 2024-10-14 00:41:21 -05:00
Carson M.
2d26f1f363 refactor: opaque Error
Shaves off the `thiserror` dependency and should improve compile times slightly.
Unfortunately this does mean we can't match on `Error` anymore, though I'm not sure if that was ever useful to begin with.
2024-08-31 15:17:06 -05:00
Carson M.
9f4527c10b feat: get all custom metadata keys, closes #277 2024-08-28 12:25:32 -05:00
Carson M.
c64b8ea990 refactor: usability
aka The Cleanening, part 2

- Add clearer documentation and examples for more things.
- Rework string tensors by introducing `PrimitiveTensorElementType` for primitive (i.e. f32) types, and again re-implementing `IntoTensorElementType` for `String`. This allows string tensors to be used via `Tensor<String>` instead of exclusively via `DynTensor`. Additionally, string tensors no longer require an `Allocator` to be created (which didn't make sense, since string data in Rust can only ever be stored on the CPU anyway). This also now applies to `Map`s, since their data also needed to be on the CPU anyway. (`Sequence`s are currently unaffected because I think a custom allocator could be useful for them?)
- Rework the `IoBinding` interface, and add an example clarifying the intended usage of it (ref #209). Thanks to AAce from the pyke Discord for pointing out the mutability issue in the old interface, which should be addressed now.
- Refactor `OperatorDomain::add` from the slightly-nicer-looking-but-more-confusing `fn<T>(t: T)` to just `fn<T>()` to further enforce the fact that `Operator`s are zero-sized.
- Maps can now have `String` keys.
- Remove some unused errors.
2024-06-21 15:37:39 -05:00
Carson M
393f25f6e4 feat: value specialization (#178) 2024-03-27 19:45:41 -05:00
Carson M.
33938fde8b refactor: rename SessionBuilder commit methods 2024-02-28 21:17:54 -06:00
Carson M.
6e7c051a7a feat: custom ops & mutable tensors 2024-02-22 19:53:51 -06:00
Carson M.
ca8ea39421 fix: revert upsample.rs 2024-01-12 16:50:11 -06:00
Carson M.
ea7d0597f7 feat: update environment after initialization 2024-01-12 16:47:27 -06:00
Carson M.
a68370297d refactor: split out run_with_options 2024-01-12 11:12:20 -06:00
aykut-bozkurt
45f96c11bd feat: basic RunOptions support (#139) 2024-01-12 08:51:44 -06:00
Carson M.
5b5c61ea30 fix: squeezenet graph metadata
run *all* tests before you push ‼️
2023-12-27 23:59:24 -06:00
Carson M.
153d7afdb9 refactor: remove model zoo URLs 2023-12-27 23:56:00 -06:00
Carson M.
3014a5b4ad ci(test): use cross-rs directly for cross compile 2023-12-13 19:37:48 -06:00
Carson M.
534a42a80c refactor: improve onnxruntime logging 2023-12-05 16:33:40 -06:00
Carson M.
c69064f443 refactor: create environment in global OnceLock 2023-11-20 21:05:50 -06:00
Carson M.
e5d8b6daae refactor: move example data to respective folders 2023-11-12 23:18:22 -06:00
Carson M.
a802cf4dc8 refactor: cleanup type names, make custom ops optional 2023-11-01 23:06:56 -05:00
Carson M.
98fd656f79 refactor: less cows and less IxDyns 2023-10-22 00:51:34 -05:00
Ivan Krivosheev
35f2613ce4 feat: split sys into separate crate (#104)
* Created ort-sys create

* Fixed CI
2023-10-18 17:09:43 -05:00
Ivan Krivosheev
de7b70c8e6 feat: not only TensorType for Input-Output params (#102)
* ci: replace actions-rs with dtolnay/rust-toolchain (#101)

* Fixed work with parameters

* Fixed docs
2023-10-18 10:51:56 -05:00
Carson M.
9a631f1d0d simplify, fix leaks & bad error messages 2023-10-03 14:14:29 -05:00
Carson M.
05eba28ecd fix upsample test 2023-08-27 11:10:35 -05:00