nn.gates.layers
fn dropout_gate #
fn dropout_gate[T](mask &vtl.Tensor[T], prob f64) &DropoutGate[T]
dropout_gate exposes this operation as part of the public API.
fn flatten_gate #
fn flatten_gate[T](input &autograd.Variable[T], cached_shape []int) &FlattenGate[T]
flatten_gate exposes this operation as part of the public API.
fn input_gate #
fn input_gate[T]() &InputGate[T]
input_gate exposes this operation as part of the public API.
fn linear_gate #
fn linear_gate[T](input &autograd.Variable[T], weight &autograd.Variable[T], bias &autograd.Variable[T]) &LinearGate[T]
linear_gate exposes this operation as part of the public API.
fn linear_gate_backward_f32_try #
fn linear_gate_backward_f32_try(gate voidptr, payload voidptr) ?[]&vtl.Tensor[f32]
Stub when not built with -d vulkan (keeps f32 Gate backward on CPU).
fn linear_gate_use_cuda_backward #
fn linear_gate_use_cuda_backward() bool
linear_gate_use_cuda_backward exposes this operation as part of the public API.
fn linear_gate_use_vulkan_backward #
fn linear_gate_use_vulkan_backward() bool
linear_gate_use_vulkan_backward exposes this operation as part of the public API.
fn lstm_gate #
fn lstm_gate[T](input_ &vtl.Tensor[T],
hidden_ &vtl.Tensor[T],
cell_ &vtl.Tensor[T],
w_ih &vtl.Tensor[T],
w_hh &vtl.Tensor[T],
b_ih &vtl.Tensor[T],
b_hh &vtl.Tensor[T]) &LSTMGate[T]
lstm_gate exposes this operation as part of the public API.
fn maxpool2d_gate #
fn maxpool2d_gate[T](max_indices &vtl.Tensor[int], kernel []int, shape []int, stride []int, padding []int) &MaxPool2DGate[T]
maxpool2d_gate exposes this operation as part of the public API.
fn (DropoutGate[T]) backward #
fn (g &DropoutGate[T]) backward(payload &autograd.Payload[T]) ![]&vtl.Tensor[T]
backward exposes this operation as part of the public API.
fn (DropoutGate[T]) cache #
fn (g &DropoutGate[T]) cache(mut result autograd.Variable[T], args ...autograd.CacheParam) !
cache exposes this operation as part of the public API.
fn (FlattenGate[T]) backward #
fn (g &FlattenGate[T]) backward(payload &autograd.Payload[T]) ![]&vtl.Tensor[T]
backward exposes this operation as part of the public API.
fn (FlattenGate[T]) cache #
fn (g &FlattenGate[T]) cache(mut result autograd.Variable[T], args ...autograd.CacheParam) !
cache exposes this operation as part of the public API.
fn (InputGate[T]) backward #
fn (g &InputGate[T]) backward(payload &autograd.Payload[T]) ![]&vtl.Tensor[T]
backward exposes this operation as part of the public API.
fn (InputGate[T]) cache #
fn (g &InputGate[T]) cache(mut result autograd.Variable[T], args ...autograd.CacheParam) !
cache exposes this operation as part of the public API.
fn (LSTMGate[T]) backward #
fn (g &LSTMGate[T]) backward(payload &autograd.Payload[T]) ![]&vtl.Tensor[T]
backward exposes this operation as part of the public API.
fn (LSTMGate[T]) cache #
fn (g &LSTMGate[T]) cache(mut result autograd.Variable[T], args ...autograd.CacheParam) !
cache exposes this operation as part of the public API.
fn (LinearGate[T]) backward #
fn (g &LinearGate[T]) backward(payload &autograd.Payload[T]) ![]&vtl.Tensor[T]
backward exposes this operation as part of the public API.
fn (LinearGate[T]) cache #
fn (g &LinearGate[T]) cache(mut result autograd.Variable[T], args ...autograd.CacheParam) !
cache exposes this operation as part of the public API.
fn (MaxPool2DGate[T]) backward #
fn (g &MaxPool2DGate[T]) backward(payload &autograd.Payload[T]) ![]&vtl.Tensor[T]
backward exposes this operation as part of the public API.
fn (MaxPool2DGate[T]) cache #
fn (g &MaxPool2DGate[T]) cache(mut result autograd.Variable[T], args ...autograd.CacheParam) !
cache exposes this operation as part of the public API.
struct DropoutGate #
struct DropoutGate[T] {
pub:
prob f64
mask &vtl.Tensor[T] = unsafe { nil }
}
DropoutGate defines a public data structure for this module.
struct FlattenGate #
struct FlattenGate[T] {
pub:
input &autograd.Variable[T] = unsafe { nil }
cached_shape []int
}
FlattenGate defines a public data structure for this module.
struct InputGate #
struct InputGate[T] {}
InputGate defines a public data structure for this module.
struct LSTMGate #
struct LSTMGate[T] {
input_ &vtl.Tensor[T] = unsafe { nil }
hidden_ &vtl.Tensor[T] = unsafe { nil }
cell_ &vtl.Tensor[T] = unsafe { nil }
w_ih &vtl.Tensor[T] = unsafe { nil }
w_hh &vtl.Tensor[T] = unsafe { nil }
b_ih &vtl.Tensor[T] = unsafe { nil }
b_hh &vtl.Tensor[T] = unsafe { nil }
}
LSTMGate implements the forward pass of LSTM with full gradients. This is a basic implementation; for production use an optimized version.
struct LinearGate #
struct LinearGate[T] {
pub:
input &autograd.Variable[T] = unsafe { nil }
weight &autograd.Variable[T] = unsafe { nil }
bias &autograd.Variable[T] = unsafe { nil }
}
LinearGate defines a public data structure for this module.
struct MaxPool2DGate #
struct MaxPool2DGate[T] {
pub:
max_indices &vtl.Tensor[int] = unsafe { nil }
kernel []int
shape []int
stride []int
padding []int
}
MaxPool2DGate defines a public data structure for this module.
- fn dropout_gate
- fn flatten_gate
- fn input_gate
- fn linear_gate
- fn linear_gate_backward_f32_try
- fn linear_gate_use_cuda_backward
- fn linear_gate_use_vulkan_backward
- fn lstm_gate
- fn maxpool2d_gate
- type DropoutGate[T]
- type FlattenGate[T]
- type InputGate[T]
- type LSTMGate[T]
- type LinearGate[T]
- type MaxPool2DGate[T]
- struct DropoutGate
- struct FlattenGate
- struct InputGate
- struct LSTMGate
- struct LinearGate
- struct MaxPool2DGate