ReferenceSPQL

Tensors & Vectors

Tensor and vector math, including similarity measures and norms.

Scalar Functions

FunctionSummary
spql.tensor.cosine_similarityCompute the row-wise cosine similarity between two vectors.
spql.tensor.inner_productCompute the row-wise inner product between two vectors.
spql.tensor.l2_normCompute the row-wise Euclidean norm of a vector.
spql.tensor.resizeResize the spatial dimensions of a Tensor.
spql.vector.dequantizeDecode a TurboQuant value into a vector.
spql.vector.rabitqQuantize a vector into the RaBitQ representation.
spql.vector.turboquantEncode a vector into the lossy TurboQuant representation.

spql.tensor.cosine_similarity

Compute the row-wise cosine similarity between two vectors.

  • Kind: scalar function
  • Volatility: immutable
spql.tensor.cosine_similarity(lhs, rhs) -> inferred

The result type and nullability are inferred from the argument types when the call is bound.

Parameters

NameRequiredTypeDescription
lhsyesvortex.tensor.vectorLeft tensor-like value.
rhsyesvortex.tensor.vectorRight tensor-like value.

Returns

A float scalar value.

spql.tensor.cosine_similarity(lhs, rhs) -> inferred

The result type and nullability are inferred from the argument types when the call is bound.

Compute the row-wise cosine similarity between two static tensors.

Parameters

NameRequiredTypeDescription
lhsyesvortex.tensor.fixed_shape_tensorLeft tensor-like value.
rhsyesvortex.tensor.fixed_shape_tensorRight tensor-like value.

Returns

A float scalar value.

spql.tensor.inner_product

Compute the row-wise inner product between two vectors.

  • Kind: scalar function
  • Volatility: immutable
spql.tensor.inner_product(lhs, rhs) -> inferred

The result type and nullability are inferred from the argument types when the call is bound.

Parameters

NameRequiredTypeDescription
lhsyesvortex.tensor.vectorLeft tensor-like value.
rhsyesvortex.tensor.vectorRight tensor-like value.

Returns

A float scalar value.

spql.tensor.inner_product(lhs, rhs) -> inferred

The result type and nullability are inferred from the argument types when the call is bound.

Compute the row-wise Frobenius inner product between two static tensors.

Parameters

NameRequiredTypeDescription
lhsyesvortex.tensor.fixed_shape_tensorLeft tensor-like value.
rhsyesvortex.tensor.fixed_shape_tensorRight tensor-like value.

Returns

A float scalar value.

spql.tensor.l2_norm

Compute the row-wise Euclidean norm of a vector.

  • Kind: scalar function
  • Volatility: immutable
spql.tensor.l2_norm(value) -> inferred

The result type and nullability are inferred from the argument types when the call is bound.

Parameters

NameRequiredTypeDescription
valueyesvortex.tensor.vectorTensor-like value.

Returns

A float scalar value.

spql.tensor.l2_norm(value) -> inferred

The result type and nullability are inferred from the argument types when the call is bound.

Compute the row-wise Euclidean norm of a static tensor.

Parameters

NameRequiredTypeDescription
valueyesvortex.tensor.fixed_shape_tensorTensor-like value.

Returns

A float scalar value.

spql.tensor.resize

Resize the spatial dimensions of a Tensor.

  • Kind: scalar function
  • Volatility: immutable
spql.tensor.resize(tensor, 1, 1, 'method'?) -> type(tensor)

Same type and nullability as tensor. Literal arguments can refine the result type, including its units, shape or element type.

Accepts contiguous u8 or f32 variable Tensor rows in height:width, height:width:channel, or channel:height:width layout. Uses half-pixel coordinates and preserves element type, nullability, permutation, and non-spatial dimensions. Execution defaults to Host; explicit MPS execution is native for direct Tensor fields and exact tensor.resize(image.to_tensor(...)) regions. In a CUDA-enabled build with NPP 13 or later runtime libraries, explicit CUDA execution is native for direct Tensor fields and supports nearest for u8 or f32, bilinear for f32, HWC with 1, 3, or 4 channels, and CHW with any channel count. Bilinear is the default method, so u8 CUDA calls must select nearest explicitly. Other computed Tensor inputs are rejected rather than staged through Host.

Parameters

NameRequiredTypeDescription
tensoryesspql.TensorTensor with named height and width dimensions.
widthyesi32Nonzero output width.
heightyesi32Nonzero output height.
methodnoutf8Interpolation method: nearest or bilinear.

Returns

A Tensor with the requested spatial dimensions.

spql.vector.dequantize

Decode a TurboQuant value into a vector.

  • Kind: scalar function
  • Volatility: immutable
spql.vector.dequantize(value) -> inferred

The result type and nullability are inferred from the argument types when the call is bound.

Parameters

NameRequiredTypeDescription
valueyesvortex.turboquantTurboQuant value to decode.

Returns

A decoded vector value.

spql.vector.rabitq

Quantize a vector into the RaBitQ representation.

  • Kind: scalar function
  • Volatility: immutable
spql.vector.rabitq(value) -> inferred

The result type and nullability are inferred from the argument types when the call is bound.

Parameters

NameRequiredTypeDescription
valueyesvortex.tensor.vectorFloating vector to quantize.

Returns

A spql.RaBitQ value.

spql.vector.turboquant

Encode a vector into the lossy TurboQuant representation.

  • Kind: scalar function
  • Volatility: immutable
spql.vector.turboquant(value) -> inferred

The result type and nullability are inferred from the argument types when the call is bound.

Parameters

NameRequiredTypeDescription
valueyesvortex.tensor.vectorVector value to encode.

Returns

A TurboQuant extension value.

Found a problem? Edit this page or report an issue.

On this page