Skip to main content

//clika-runtime/io.clika.runtime/TensorSpec

TensorSpec

[common]
class TensorSpec(val name: String, val dtype: DType = DType.FLOAT32, val dims: LongArray = LongArray(0), val optional: Boolean = false, val dimNames: List<String> = emptyList())

A named, typed tensor slot of a model's contract. A dims entry equal to DYNAMIC_DIM resolves at run time and an empty dims leaves the shape unconstrained; dimNames is empty or dims-long with "" for an unnamed dim, and the same name on two slots declares one size; optional marks an input the model runs without.

Constructors​

TensorSpec[common]
constructor(name: String, dtype: DType = DType.FLOAT32, dims: LongArray = LongArray(0), optional: Boolean = false, dimNames: List<String> = emptyList())

Types​

NameSummary
Companion[common]
object Companion

Properties​

NameSummary
dimNames[common]
val dimNames: List<String>
dims[common]
val dims: LongArray
dtype[common]
val dtype: DType
name[common]
val name: String
optional[common]
val optional: Boolean = false

Functions​

NameSummary
dimIsDynamic[common]
fun dimIsDynamic(i: Int): Boolean
True when dim i is dynamic.
dimName[common]
fun dimName(i: Int): String
The dim's declared name, or "" (unnamed or out of range).
mergeFrom[common]
fun mergeFrom(other: TensorSpec): TensorSpec
This spec widened by another observation of the same slot: a dim dynamic on either side stays dynamic, differing extents become dynamic, a rank clash makes every dim dynamic at the larger rank; a dim name is kept where the two agree or one is unnamed; the name and optional are this spec's (the name adopted from other when empty). Fails when the dtypes differ.
toString[common]
open override fun toString(): String