brainpy.nn.nodes.ANN.GeneralConv
brainpy.nn.nodes.ANN.GeneralConv#
- class brainpy.nn.nodes.ANN.GeneralConv(out_channels, kernel_size, strides=None, padding='SAME', input_dilation=None, kernel_dilation=None, groups=1, w_init=XavierNormal(scale=1.0, mode=fan_avg, in_axis=- 2, out_axis=- 1, distribution=truncated_normal, seed=None), b_init=ZeroInit, **kwargs)[source]#
Applies a convolution to the inputs.
- Parameters
out_channels – integer number of output channels.
kernel_size – sequence[int] shape of the convolutional kernel. For 1D convolution, the kernel size can be passed as an integer. For all other cases, it must be a sequence of integers.
strides – sequence[int] an integer or a sequence of n integers, representing the inter-window strides (default: 1).
padding – str, sequence[int] either the string ‘SAME’, the string ‘VALID’, the string ‘CIRCULAR’ (periodic boundary conditions), or a sequence of n (low, high) integer pairs that give the padding to apply before and after each spatial dimension. A single int is interpeted as applying the same padding in all dims and passign a single int in a sequence causes the same padding to be used on both sides.
input_dilation – integer, sequence[int] an integer or a sequence of n integers, giving the dilation factor to apply in each spatial dimension of inputs (default: 1). Convolution with input dilation d is equivalent to transposed convolution with stride d.
kernel_dilation – integer, sequence[int] an integer or a sequence of n integers, giving the dilation factor to apply in each spatial dimension of the convolution kernel (default: 1). Convolution with kernel dilation is also known as ‘atrous convolution’.
groups – integer, default 1. If specified divides the input features into groups.
kernel_init – brainpy.init.Initializer initializer for the convolutional kernel.
bias_init – brainpy.init.Initializer initializer for the bias.
- __init__(out_channels, kernel_size, strides=None, padding='SAME', input_dilation=None, kernel_dilation=None, groups=1, w_init=XavierNormal(scale=1.0, mode=fan_avg, in_axis=- 2, out_axis=- 1, distribution=truncated_normal, seed=None), b_init=ZeroInit, **kwargs)[source]#
Methods
__init__
(out_channels, kernel_size[, ...])copy
([name, shallow])Returns a copy of the Node.
feedback
(ff_output, **shared_kwargs)The feedback computation function of a node.
forward
(ff[, fb])The feedforward computation function of a node.
init_fb_conn
()Initialize the feedback connections.
init_fb_output
([num_batch])Set the initial node feedback state.
init_ff_conn
()Initialize the feedforward connections.
init_state
([num_batch])Set the initial node state.
initialize
([num_batch])Initialize the node.
load_states
(filename[, verbose])Load the model states.
nodes
([method, level, include_self])Collect all children nodes.
offline_fit
(targets, ffs[, fbs])Offline training interface.
online_fit
(target, ff[, fb])Online training fitting interface.
online_init
()Online training initialization interface.
register_implicit_nodes
(nodes)register_implicit_vars
(variables)save_states
(filename[, variables])Save the model states.
set_fb_output
(state)Safely set the feedback state of the node.
set_feedback_shapes
(fb_shapes)set_feedforward_shapes
(feedforward_shapes)set_output_shape
(shape)set_state
(state)Safely set the state of the node.
train_vars
([method, level, include_self])The shortcut for retrieving all trainable variables.
unique_name
([name, type_])Get the unique name for this object.
vars
([method, level, include_self])Collect all variables in this node and the children nodes.
Attributes
data_pass
Offline fitting method.
fb_output
feedback_shapes
Output data size.
feedforward_shapes
Input data size.
is_feedback_input_supported
is_feedback_supported
is_initialized
- rtype
name
output_shape
Output data size.
state
Node current internal state.
trainable
Returns if the Node can be trained.