ndonnx package
Submodules
- ndonnx.extensions module
datetime_to_year_month_day()fill_null()get_data()get_mask()is_float_dtype()is_integer_dtype()is_nullable_dtype()is_nullable_float_dtype()is_nullable_integer_dtype()is_nullable_numeric_dtype()is_numeric_dtype()is_onnx_dtype()is_signed_integer_dtype()is_time_unit()is_unsigned_integer_dtype()isin()make_nullable()put()shape()static_map()
- ndonnx.types module
Module contents
- class ndonnx.Array(*args, **kwargs)[source][source]
Bases:
objectUser-facing objects that makes no assumption about any data type related logic.
- all(axis: int | tuple[int, ...] | None = 0, keepdims: bool = False) Array[source][source]
See
ndonnx.all()for documentation.
- any(axis: int | tuple[int, ...] | None = 0, keepdims: bool = False) Array[source][source]
See
ndonnx.any()for documentation.
- property device: Device
- disassemble() dict[str, Var] | Var[source][source]
Disassemble into the constituent
spox.Varobjects.The particular layout depends on the data type.
- property dynamic_size: Array
Return the size of an array as scalar array.
Contrary to Array.size this function also works on dynamically sized arrays.
- max(axis: int | tuple[int, ...] | None = 0, keepdims: bool = False) Array[source][source]
See
ndonnx.max()for documentation.
- min(axis: int | tuple[int, ...] | None = 0, keepdims: bool = False) Array[source][source]
See
ndonnx.min()for documentation.
- property ndim: int
- prod(axis: int | tuple[int, ...] | None = 0, keepdims: bool = False) Array[source][source]
See
ndonnx.prod()for documentation.
- property shape: tuple[int | None, ...]
- property size: int | None
- spox_var() Var[source][source]
Unwrap the underlying
spox.Varobject ifselfis of primitive data type.Otherwise, raise an exception.
- sum(axis: int | tuple[int, ...] | None = 0, keepdims: bool = False) Array[source][source]
See
ndonnx.sum()for documentation.
- unwrap_numpy() ndarray[source][source]
Return the propagated value as a NumPy array if available.
- Raises:
- ValueError:
If no propagated value is available.
- class ndonnx.DateTime64DType(unit: Literal['ns', 'us', 'ms', 's'])[source][source]
Bases:
BaseTimeDType[TyArrayDateTime]
- class ndonnx.TimeDelta64DType(unit: Literal['ns', 'us', 'ms', 's'])[source][source]
Bases:
BaseTimeDType[TyArrayTimeDelta]
- ndonnx.all(x: Array, /, *, axis: int | tuple[int, ...] | None = None, keepdims: bool = False) Array[source][source]
- ndonnx.any(x: Array, /, *, axis: int | tuple[int, ...] | None = None, keepdims: bool = False) Array[source][source]
- ndonnx.arange(start: int | float | Array, /, stop: int | float | Array | None = None, step: int | float | Array = 1, *, dtype: DType | None = None, device: None | Device = None) Array[source][source]
- ndonnx.argmax(x: Array, /, *, axis: int | None = None, keepdims: bool = False) Array[source][source]
- ndonnx.argmin(x: Array, /, *, axis: int | None = None, keepdims: bool = False) Array[source][source]
- ndonnx.argsort(x: Array, /, *, axis: int = -1, descending: bool = False, stable: bool = True) Array[source][source]
- ndonnx.argument(*, shape: tuple[int | str | None, ...], dtype: DType) Array[source][source]
Creates a new lazy ndonnx array.
- This is used to define inputs to an ONNX model.
- shape
The shape of the array. String-dimensions denote symbolic dimensions and must be globally consistent. None-dimensions denote unknown dimensions.
- dtype
The data type of the array.
- Returns:
- Array
The new array representing input(s) of the computational graphs.
- ndonnx.asarray(obj: Array | bool | int | float | str | ndarray | Sequence[bool | int | float | str | Sequence[PyScalar | NestedSequence]] | Var, /, *, dtype: DType | None = None, device: None | Device = None, copy: bool | None = None) Array[source][source]
- ndonnx.astype(x: Array, dtype: DType, /, *, copy: bool = True, device: None | Device = None) Array[source][source]
- ndonnx.build(inputs: dict[str, Array], outputs: dict[str, Array], drop_unused=False) ModelProto[source][source]
Build and ONNX model from the provided argument-Arrays and outputs.
- Parameters:
- inputs
Inputs of the model
- outputs
Outputs of the model
- Returns:
- onnx.ModelProto
ONNX model
- ndonnx.clip(x: Array, /, min: None | int | float | Array = None, max: None | int | float | Array = None) Array[source][source]
- ndonnx.concat(arrays: tuple[Array, ...] | list[Array], /, *, axis: None | int = 0) Array[source][source]
- ndonnx.count_nonzero(x: Array, /, *, axis: int | tuple[int, ...] | None = None, keepdims: bool = False) Array[source][source]
- ndonnx.cumulative_prod(x: Array, /, *, axis: int | None = None, dtype: DType | None = None, include_initial: bool = False) Array[source][source]
- ndonnx.cumulative_sum(x: Array, /, *, axis: int | None = None, dtype: DType | None = None, include_initial: bool = False) Array[source][source]
- ndonnx.diff(a: Array, /, *, axis: int = -1, n: int = 1, prepend: Array | None = None, append: Array | None = None) Array[source][source]
- ndonnx.empty(shape: int | tuple[int, ...], *, dtype: DType | None = None, device: None | Device = None) Array[source][source]
- ndonnx.empty_like(x: Array, /, *, dtype: DType | None = None, device: None | Device = None) Array[source][source]
- ndonnx.equal(x1: Array | int | float | bool, x2: Array | int | float | bool, /) Array[source][source]
- ndonnx.eye(n_rows: int, n_cols: int | None = None, /, *, k: int = 0, dtype: DType | None = None, device: None | Device = None) Array[source][source]
- ndonnx.from_dlpack(x: object, /, *, device: None = None, copy: bool | None = None) Array[source][source]
- ndonnx.from_numpy_dtype(np_dtype: dtype) Float16 | Float32 | Float64 | Int8 | Int16 | Int32 | Int64 | UInt8 | UInt16 | UInt32 | UInt64 | Utf8 | Bool | TimeDelta64DType | DateTime64DType[source][source]
- ndonnx.full(shape: int | tuple[int, ...] | Array, fill_value: bool | int | float | str, *, dtype: DType | None = None, device: None | Device = None) Array[source][source]
- ndonnx.full_like(x: Array, /, fill_value: bool | int | float | str, *, dtype: DType | None = None, device: None | Device = None) Array[source][source]
- ndonnx.linspace(start: int | float | complex, stop: int | float | complex, /, num: int, *, dtype: DType | None = None, device: None | Device = None, endpoint: bool = True) Array[source][source]
- ndonnx.max(x: Array, /, *, axis: int | tuple[int, ...] | None = None, keepdims: bool = False) Array[source][source]
Calculates the maximum value of the input array x.
Reduction over zero-sized inputs return the minimum possible value for the input data type.
- ndonnx.mean(x: Array, /, *, axis: int | tuple[int, ...] | None = None, keepdims: bool = False) Array[source][source]
- ndonnx.min(x: Array, /, *, axis: int | tuple[int, ...] | None = None, keepdims: bool = False) Array[source][source]
Calculates the minimum value of the input array x.
Reduction over zero-sized inputs return the maximum possible value for the input data type.
- ndonnx.moveaxis(x: Array, source: int | tuple[int, ...], destination: int | tuple[int, ...], /) Array[source][source]
- ndonnx.not_equal(x1: Array | int | float | bool, x2: Array | int | float | bool, /) Array[source][source]
- ndonnx.ones(shape: int | tuple[int, ...], *, dtype: DType | None = None, device: None | Device = None) Array[source][source]
- ndonnx.ones_like(x: Array, /, *, dtype: DType | None = None, device: None | Device = None) Array[source][source]
- ndonnx.prod(x: Array, /, *, axis: int | tuple[int, ...] | None = None, dtype: DType | None = None, keepdims: bool = False) Array[source][source]
- ndonnx.reshape(x: Array, /, shape: tuple[int, ...] | Array, *, copy: bool | None = None) Array[source][source]
- ndonnx.result_type(*arrays_and_dtypes: Array | DType | bool | int | float | str) DType[source][source]
- ndonnx.roll(x: Array, /, shift: int | tuple[int, ...], *, axis: int | tuple[int, ...] | None = None) Array[source][source]
- ndonnx.searchsorted(x1: Array, x2: Array, /, *, side: Literal['left', 'right'] = 'left', sorter: Array | None = None) Array[source][source]
- ndonnx.sort(x: Array, /, *, axis: int = -1, descending: bool = False, stable: bool = True) Array[source][source]
- ndonnx.std(x: Array, /, *, axis: int | tuple[int, ...] | None = None, correction: int | float = 0.0, keepdims: bool = False) Array[source][source]
- ndonnx.sum(x: Array, /, *, axis: int | tuple[int, ...] | None = None, dtype: DType | None = None, keepdims: bool = False) Array[source][source]
- ndonnx.tensordot(x1: Array, x2: Array, /, *, axes: int | tuple[Sequence[int], Sequence[int]] = 2) Array[source][source]
- ndonnx.to_nullable_dtype(dtype: _OnnxDType | NBool | NFloat16 | NFloat32 | NFloat64 | NInt8 | NInt16 | NInt32 | NInt64 | NUInt8 | NUInt16 | NUInt32 | NUInt64 | NUtf8) NBool | NFloat16 | NFloat32 | NFloat64 | NInt8 | NInt16 | NInt32 | NInt64 | NUInt8 | NUInt16 | NUInt32 | NUInt64 | NUtf8[source][source]
- ndonnx.var(x: Array, /, *, axis: int | tuple[int, ...] | None = None, correction: int | float = 0.0, keepdims: bool = False) Array[source][source]
- ndonnx.where(cond: Array, a: Array | int | float | bool | str, b: Array | int | float | bool | str) Array[source][source]