Skip to main content

Module data

Module data 

Source
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§

ApproximateTensorStatistics
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.
DataErrorDescriptor
One data-error name and its source-of-truth documentation.
HistogramBucket
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.
TensorInspection
A bounded inspection of a tensor’s logical values and retained storage.
TensorInspectionOptions
Bounds for one TensorInspection.
Video
Immutable decoded video frames with increasing presentation timestamps.
VideoFrame
One decoded image with a presentation timestamp in a host-defined timeline. Timestamps serialize as decimal strings to preserve the full unsigned range.

Enums§

ApproximationUnavailable
Why binary64 approximate statistics could not be represented honestly.
AxisIndex
One item in a tensor indexing expression.
BinaryOp
Checked elementwise arithmetic shared by scalar and tensor evaluation.
DType
Declared numeric representation, independent of the host architecture.
DataError
Failure to construct, index, convert, or evaluate typed data.
ImageFormat
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.
TensorStatistics
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.