ActivationDsl

@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class ActivationDsl(val dslName: String = "")(source)

Annotation to mark TensorOps methods for automatic Network DSL generation.

When applied to activation methods in TensorOps, the KSP processor will generate extension functions for NeuralNetworkDsl that provide convenient DSL methods.

Example:

@ActivationDsl
fun <T : DType, V> relu(tensor: Tensor<T, V>): Tensor<T, V>

This will generate:

fun <T : DType, V> NeuralNetworkDsl<T, V>.relu(id: String = "") {
activation(id) { it.relu() }
}

Parameters

dslName

Optional custom name for the DSL method (defaults to the method name)

Properties

Link copied to clipboard