Skip to main content

//clika-runtime/io.clika.runtime/Linear

Linear

[jvm]
class Linear@JvmOverloadsconstructor(weight: Tensor, bias: Tensor? = null, activation: Int? = null) : Module, AutoCloseable

A dense layer: input @ weight^T + bias, with an optional fused activation (ClikaRtGen.ACTIVATION_*).

The layer RETAINS its own reference to weight (and bias) at construction; the caller keeps ownership of the passed handles and may release them independently; close drops the layer's references.

Constructors

Linear[jvm]
@JvmOverloads
constructor(weight: Tensor, bias: Tensor? = null, activation: Int? = null)

Functions

NameSummary
close[jvm]
open override fun close()
forward[jvm]
open override fun forward(input: Tensor): Tensor
Run the module. Non-consuming: input stays valid.
invoke[jvm]
open operator fun invoke(input: Tensor): Tensor
module(x): the call spelling of forward.