nn.models #
fn sequential #
fn sequential[T]() &Sequential[T]
sequential creates a new sequential network with a new context.
fn sequential_from_ctx #
fn sequential_from_ctx[T](ctx &autograd.Context[T]) &Sequential[T]
sequential_from_ctx creates a new sequential network with the given context.
fn sequential_from_ctx_with_layers #
fn sequential_from_ctx_with_layers[T](ctx &autograd.Context[T], given_layers []types.Layer[T]) &Sequential[T]
sequential_from_ctx_with_layers creates a new sequential network with the given context and the given layers.
fn sequential_info #
fn sequential_info[T](ctx &autograd.Context[T], layers_ []types.Layer[T]) &SequentialInfo[T]
sequential_info creates a new neural network container with an empty list of layers.
fn sequential_with_layers #
fn sequential_with_layers[T](given_layers []types.Layer[T]) &Sequential[T]
sequential_with_layers creates a new sequential network with a new context and the given layers.
fn (SequentialInfo[T]) input #
fn (mut ls SequentialInfo[T]) input(shape []int)
input adds a new input layer to the network with the given shape.
fn (SequentialInfo[T]) linear #
fn (mut ls SequentialInfo[T]) linear(output_size int)
linear adds a new linear layer to the network with the given output size
fn (SequentialInfo[T]) maxpool2d #
fn (mut ls SequentialInfo[T]) maxpool2d(kernel []int, padding []int, stride []int)
maxpool2d adds a new maxpool2d layer to the network with the given kernel size and stride.
fn (SequentialInfo[T]) mse_loss #
fn (mut ls SequentialInfo[T]) mse_loss()
mse_loss sets the loss function to the mean squared error loss.
fn (SequentialInfo[T]) sigmoid_cross_entropy_loss #
fn (mut ls SequentialInfo[T]) sigmoid_cross_entropy_loss()
sigmoid_cross_entropy_loss sets the loss function to the sigmoid cross entropy loss.
fn (SequentialInfo[T]) softmax_cross_entropy_loss #
fn (mut ls SequentialInfo[T]) softmax_cross_entropy_loss()
softmax_cross_entropy_loss sets the loss function to the softmax cross entropy loss.
fn (SequentialInfo[T]) flatten #
fn (mut ls SequentialInfo[T]) flatten()
flatten adds a new flatten layer to the network.
fn (SequentialInfo[T]) relu #
fn (mut ls SequentialInfo[T]) relu()
relu adds a new relu layer to the network.
fn (SequentialInfo[T]) leaky_relu #
fn (mut ls SequentialInfo[T]) leaky_relu()
leaky_relu adds a new leaky_relu layer to the network.
fn (SequentialInfo[T]) elu #
fn (mut ls SequentialInfo[T]) elu()
elu adds a new elu layer to the network.
fn (SequentialInfo[T]) sigmod #
fn (mut ls SequentialInfo[T]) sigmod()
sigmod adds a new sigmod layer to the network.
fn (Sequential[T]) input #
fn (mut nn Sequential[T]) input(shape []int)
input adds a new input layer to the network with the given shape.
fn (Sequential[T]) linear #
fn (mut nn Sequential[T]) linear(output_size int)
linear adds a new linear layer to the network with the given output size
fn (Sequential[T]) maxpool2d #
fn (mut nn Sequential[T]) maxpool2d(kernel []int, padding []int, stride []int)
maxpool2d adds a new maxpool2d layer to the network with the given kernel size and stride.
fn (Sequential[T]) mse_loss #
fn (mut nn Sequential[T]) mse_loss()
mse_loss sets the loss function to the mean squared error loss.
fn (Sequential[T]) sigmoid_cross_entropy_loss #
fn (mut nn Sequential[T]) sigmoid_cross_entropy_loss()
sigmoid_cross_entropy_loss sets the loss function to the sigmoid cross entropy loss.
fn (Sequential[T]) softmax_cross_entropy_loss #
fn (mut nn Sequential[T]) softmax_cross_entropy_loss()
softmax_cross_entropy_loss sets the loss function to the softmax cross entropy loss.
fn (Sequential[T]) flatten #
fn (mut nn Sequential[T]) flatten()
flatten adds a new flatten layer to the network.
fn (Sequential[T]) relu #
fn (mut nn Sequential[T]) relu()
relu adds a new relu layer to the network.
fn (Sequential[T]) leaky_relu #
fn (mut nn Sequential[T]) leaky_relu()
leaky_relu adds a new leaky_relu layer to the network.
fn (Sequential[T]) elu #
fn (mut nn Sequential[T]) elu()
elu adds a new elu layer to the network.
fn (Sequential[T]) sigmod #
fn (mut nn Sequential[T]) sigmod()
sigmod adds a new sigmod layer to the network.
fn (Sequential[T]) forward #
fn (mut nn Sequential[T]) forward(mut train autograd.Variable[T]) !&autograd.Variable[T]
fn (Sequential[T]) loss #
fn (mut nn Sequential[T]) loss(output &autograd.Variable[T], target &vtl.Tensor[T]) !&autograd.Variable[T]
struct Sequential #
struct Sequential[T] {
pub mut:
info &SequentialInfo[T] = unsafe { nil }
}
struct SequentialInfo #
struct SequentialInfo[T] {
ctx &autograd.Context[T] = unsafe { nil }
pub mut:
layers []types.Layer[T]
loss types.Loss
}