brainpy.dyn.layers.GeneralConv#

class brainpy.dyn.layers.GeneralConv(in_channels, 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=7269275), b_init=ZeroInit, mode=TrainingMode, name=None)[source]#

Applies a convolution to the inputs.

Parameters
  • in_channels (integer) – number of input channels.

  • 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.

  • w_init (brainpy.init.Initializer) – initializer for the convolutional kernel.

  • b_init (brainpy.init.Initializer) – initializer for the bias.

__init__(in_channels, 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=7269275), b_init=ZeroInit, mode=TrainingMode, name=None)[source]#

Methods

__init__(in_channels, out_channels, kernel_size)

clear_input()

get_delay_data(identifier, delay_step, *indices)

Get delay data according to the provided delay steps.

load_states(filename[, verbose])

Load the model states.

nodes([method, level, include_self])

Collect all children nodes.

offline_fit(target, fit_record)

offline_init()

online_fit(target, fit_record)

online_init()

register_delay(identifier, delay_step, ...)

Register delay variable.

register_implicit_nodes(*nodes, **named_nodes)

register_implicit_vars(*variables, ...)

reset([batch_size])

Reset function which reset the whole variables in the model.

reset_local_delays([nodes])

Reset local delay variables.

reset_state([batch_size])

Reset function which reset the states in the model.

save_states(filename[, variables])

Save the model states.

train_vars([method, level, include_self])

The shortcut for retrieving all trainable variables.

unique_name([name, type_])

Get the unique name for this object.

update(sha, x)

The function to specify the updating rule.

update_local_delays([nodes])

Update local delay variables.

vars([method, level, include_self])

Collect all variables in this node and the children nodes.

Attributes

global_delay_data

mode

Mode of the model, which is useful to control the multiple behaviors of the model.

name

Name of the model.