ShapeBuilder

class ShapeBuilder<T : DType, V>(dtype: KClass<T>, shape: Shape)(source)

Builder for tensors with a defined shape, allowing initialization

Constructors

Link copied to clipboard
constructor(dtype: KClass<T>, shape: Shape)

Functions

Link copied to clipboard

Initialize tensor with a constant value

Link copied to clipboard

Extension function to access image-specific initializers

Link copied to clipboard
fun init(generator: (indices: IntArray) -> V): TensorInitializer<T, V>

Initialize tensor with custom function

Link copied to clipboard

Initialize tensor with ones

Link copied to clipboard
fun randn(mean: Float = 0.0f, std: Float = 1.0f, random: Random = Random.Default): TensorInitializer<T, V>

Initialize tensor with normal distribution

Link copied to clipboard
fun randomInit(generator: (random: Random) -> V, random: Random = Random.Default): TensorInitializer<T, V>

Initialize tensor with custom random distribution

Link copied to clipboard
fun uniform(min: Float = 0.0f, max: Float = 1.0f, random: Random = Random.Default): TensorInitializer<T, V>

Initialize tensor with uniform distribution

Link copied to clipboard

Initialize tensor with zeros