Dense

class Dense : TrainableLayerSingleInput<Dense>

Densely-connected layer

Constructors

Dense
Link copied to clipboard
fun Dense(numInputs: Int, numOutputs: Int, random: Random, bias: Boolean = true, activation: Activation = defaultActivation, weightInit: (Shape, Random) -> FloatTensor = defaultInit(numInputs), biasInit: (Shape, Random) -> FloatTensor = defaultInit(numInputs))

Full public constructor

Dense
Link copied to clipboard
fun Dense(numInputs: Int, numOutputs: Int, activation: Activation, random: Random, weightInit: (Shape, Random) -> FloatTensor = defaultInit(numInputs), biasInit: (Shape, Random) -> FloatTensor = defaultInit(numInputs))

Convenience constructor where bias is always true.

Types

Companion
Link copied to clipboard
object Companion

Functions

apply
Link copied to clipboard
fun apply(input: DTensor): DTensor
cpu
Link copied to clipboard
open override fun cpu(): Dense
equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
extractTangent
Link copied to clipboard
open override fun extractTangent(output: DTensor, extractor: (DTensor, DTensor) -> DTensor): TrainableComponent.Companion.Tangent
getSingleInput
Link copied to clipboard
open fun getSingleInput(inputs: Array<out DTensor>): DTensor

Helper to check that the layer was called with a single input. Returns that input if successful, else errors.

gpu
Link copied to clipboard
open override fun gpu(): Dense
hashCode
Link copied to clipboard
open override fun hashCode(): Int
invoke
Link copied to clipboard
open operator override fun invoke(input: DTensor): DTensor
abstract operator fun invoke(vararg inputs: DTensor): DTensor
load
Link copied to clipboard
open override fun load(from: ByteBuffer): Dense
store
Link copied to clipboard
open override fun store(into: ByteBuffer): ByteBuffer
to
Link copied to clipboard
open fun to(device: Device): OnDevice
trainingStep
Link copied to clipboard
open override fun trainingStep(optim: Optimizer<*>, tangent: Trainable.Tangent): Dense
withTrainables
Link copied to clipboard
open override fun withTrainables(trainables: List<Trainable<*>>): Dense
wrap
Link copied to clipboard
open override fun wrap(wrapper: Wrapper): Dense

The wrap function should return the same static type it is declared on.

Properties

activation
Link copied to clipboard
val activation: Activation
b
Link copied to clipboard
val b: DTensor
bias
Link copied to clipboard
val bias: Boolean
trainables
Link copied to clipboard
open override val trainables: List<TrainableTensor>
w
Link copied to clipboard
val w: DTensor