Expand description
Exact numeric values, immutable buffers, tensors, and validated media payloads. Immutable typed data shared by the SDK, language, and host adapters.
Numeric values retain their declared bit width. Floating-point operations use portable IEEE binary16, binary32, binary64, and binary128 software arithmetic with round-to-nearest, ties-to-even. Nonfinite values are rejected. Integer operations check overflow; conversions must preserve the exact value. Serialized scalar values are decimal strings, including small values, so a JavaScript JSON parser cannot silently round a wide integer or binary128.
Tensors store packed little-endian elements with immutable shared ownership. Indexing and slicing create views; arithmetic creates independent outputs. Media values validate the layout of decoded payloads, without implying a codec, capture device, playback engine, or live stream implementation.
use konjure_sdk::data::{AxisIndex, BinaryOp, DType, Scalar, Tensor};
let values = ["1", "2", "3", "4"].into_iter()
.map(|text| Scalar::parse(DType::I16, text)).collect::<Result<Vec<_>, _>>()?;
let matrix = Tensor::from_scalars(DType::I16, vec![2, 2], values)?;
let last_row = matrix.slice(&[AxisIndex::Index(-1)])?;
assert_eq!(last_row.sum()?.to_string(), "7");
assert_eq!(matrix.binary(BinaryOp::Add, &last_row)?.get(&[0, 0])?.to_string(), "4");Modules§
- wire
- JSON wire shapes for custom-serialized data values.
Structs§
- Approximate
Tensor Statistics - Numerically stable statistics calculated from bounded logical samples.
- Audio
- Immutable decoded audio in
[frames, channels]tensor order. - Bin
- Immutable arbitrary bytes; cloning shares the allocation.
- Data
Error Descriptor - One data-error name and its source-of-truth documentation.
- Histogram
Bucket - One compact, approximate histogram interval.
- Image
- Immutable decoded image in
[height, width, channels]tensor order. - Scalar
- One finite numeric value with an explicit declared representation.
- Str
- Immutable UTF-8 text; cloning shares the allocation.
- Tensor
- An immutable, strided tensor whose packed backing storage is shared by views.
- Tensor
Inspection - A bounded inspection of a tensor’s logical values and retained storage.
- Tensor
Inspection Options - Bounds for one
TensorInspection. - Video
- Immutable decoded video frames with increasing presentation timestamps.
- Video
Frame - One decoded image with a presentation timestamp in a host-defined timeline. Timestamps serialize as decimal strings to preserve the full unsigned range.
Enums§
- Approximation
Unavailable - Why binary64 approximate statistics could not be represented honestly.
- Axis
Index - One item in a tensor indexing expression.
- Binary
Op - Checked elementwise arithmetic shared by scalar and tensor evaluation.
- DType
- Declared numeric representation, independent of the host architecture.
- Data
Error - Failure to construct, index, convert, or evaluate typed data.
- Image
Format - Channel ordering for a decoded image. Rows are top-to-bottom; channels are interleaved in the last tensor axis. This is storage metadata, not a promise of calibrated camera orientation, color space, or camera-to-eye alignment.
- Tensor
Statistics - Approximate statistics, or an explicit reason they are unavailable.
Constants§
- HISTOGRAM_
BUCKETS - The number of buckets used for nonconstant approximate histograms.
- MAX_
ELEMENTS - Maximum number of elements admitted by one tensor.
- MAX_
INSPECTION_ PREVIEW - The largest exact prefix included in a tensor inspection.
- MAX_
INSPECTION_ SAMPLES - The largest number of logical tensor elements one inspection will read.
- MAX_
RANK - Maximum number of axes admitted by one tensor.
Functions§
- inspect_
tensor - Inspects a tensor without cloning or materializing its backing storage.