TransformScope

Scope that provides tensor transform DSL with an implicit execution context.

This allows for cleaner syntax when building pipelines within an execution context:

val pipeline = executionContext.transforms {
pipeline<Tensor<FP32, Float>>()
.rescale(255f)
.normalize(ImageNet.mean, ImageNet.std)
}

Constructors

Link copied to clipboard
constructor(ctx: ExecutionContext)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun <I> Transform<I, Tensor<T, V>>.clamp(min: Float, max: Float): Transform<I, Tensor<T, V>>

Chains a Clamp transform.

Link copied to clipboard
fun <I> Transform<I, Tensor<T, V>>.flatten(startDim: Int = 0, endDim: Int = -1): Transform<I, Tensor<T, V>>

Chains a Flatten transform.

Link copied to clipboard
fun <I> Transform<I, Tensor<T, V>>.normalize(mean: FloatArray, std: FloatArray, channelAxis: Int = -1): Transform<I, Tensor<T, V>>

Chains a Normalize transform.

Link copied to clipboard
fun <I> Transform<I, Tensor<T, V>>.rescale(scale: Float = 255.0f): Transform<I, Tensor<T, V>>

Chains a Rescale transform.

Link copied to clipboard
fun <I> Transform<I, Tensor<T, V>>.reshape(vararg dims: Int): Transform<I, Tensor<T, V>>
fun <I> Transform<I, Tensor<T, V>>.reshape(shape: Shape): Transform<I, Tensor<T, V>>

Chains a Reshape transform.

Link copied to clipboard
fun <I> Transform<I, Tensor<T, V>>.scaleAndShift(scale: Float, offset: Float = 0.0f): Transform<I, Tensor<T, V>>

Chains a ScaleAndShift transform.

Link copied to clipboard
fun <I> Transform<I, Tensor<T, V>>.squeeze(dim: Int? = null): Transform<I, Tensor<T, V>>

Chains a Squeeze transform.

Link copied to clipboard
fun <I> Transform<I, Tensor<T, V>>.unsqueeze(dim: Int): Transform<I, Tensor<T, V>>

Chains an Unsqueeze transform.