TensorSpec

data class TensorSpec(val name: String, val shape: List<Int>?, val dtype: String, val requiresGrad: Boolean = false, val metadata: Map<String, Any> = emptyMap())(source)

Specification for a tensor in the graph, containing shape and type information

Constructors

Link copied to clipboard
constructor(name: String, shape: List<Int>?, dtype: String, requiresGrad: Boolean = false, metadata: Map<String, Any> = emptyMap())

Properties

Link copied to clipboard

Data type of the tensor

Link copied to clipboard

Additional metadata for this tensor

Link copied to clipboard

Name/identifier of this tensor

Link copied to clipboard

Whether this tensor requires gradients

Link copied to clipboard
val shape: List<Int>?

Shape of the tensor (null for dynamic shapes)

Link copied to clipboard

Physical storage encoding carried on this spec, or null if the producer did not populate it.

Functions

Link copied to clipboard

Return a copy of this spec with encoding stored in its metadata map. Passing null removes the entry; passing a non-null value adds or replaces it, leaving all other metadata untouched.