class SHAInet::TransformerLayer

Defined in:

shainet/transformer/transformer_layer.cr

Constructors

Instance Method Summary

Instance methods inherited from class SHAInet::Layer

activation_function : Float32 | Float64 | Int32 | Int64 -> {Float64, Float64} activation_function, activations : Matrix(Float64) activations, biases : Matrix(Float64) biases, biases=(biases : Matrix(Float64)) biases=, clone clone, input_sums : Matrix(Float64) input_sums, input_sums=(input_sums : Matrix(Float64)) input_sums=, inspect inspect, l_size : Int32 l_size, n_type : String n_type, n_type=(n_type : String) n_type=, neurons : Array(SHAInet::Neuron) neurons, neurons=(neurons : Array(SHAInet::Neuron)) neurons=, propagate_forward_exp(prev_layer : Layer) propagate_forward_exp, random_seed random_seed, sigma_primes : Matrix(Float64) sigma_primes, size : Int32 size, type_change(new_neuron_type : String) type_change, weights : Matrix(Float64) weights, weights=(weights : Matrix(Float64)) weights=

Constructor methods inherited from class SHAInet::Layer

new(n_type : String, l_size : Int32, activation_function : ActivationFunction = SHAInet.sigmoid) new

Constructor Detail

def self.new(d_model : Int32, num_heads : Int32, ff_hidden : Int32) #

[View source]

Instance Method Detail

def apply_gradients(lr : Float64) #

[View source]
def backward(d_out : SimpleMatrix) #

[View source]
def ffn : PositionWiseFF #

[View source]
def forward(x : SimpleMatrix) #

[View source]
def mha : MultiHeadAttention #

[View source]
def neurons #

[View source]
def zero_gradients #

[View source]