Squeeze

class Squeeze<T : DType, V>(ctx: ExecutionContext, val dim: Int? = null) : TensorTransform<T, V> (source)

Removes a dimension of size 1 at the specified position.

Parameters

T

The tensor data type

V

The value type

ctx

The execution context for tensor operations

dim

The dimension to remove (must have size 1), or null to remove all size-1 dims

Constructors

Link copied to clipboard
constructor(ctx: ExecutionContext, dim: Int? = null)

Properties

Link copied to clipboard
val dim: Int?

Functions

Link copied to clipboard
open override fun apply(input: Tensor<T, V>): Tensor<T, V>

Applies this transformation to the given input.

Link copied to clipboard
open override fun getOutputShape(inputShape: Shape): Shape

By default, tensor transforms preserve the input shape. Override this method if the transform changes the shape.

Link copied to clipboard
open override fun toString(): String