brainpy.nn.nodes.ANN.MaxPool#

class brainpy.nn.nodes.ANN.MaxPool(window_shape, strides=None, padding='VALID')[source]#

Pools the input by taking the maximum over a window.

Parameters
  • window_shape – tuple a shape tuple defining the window to reduce over.

  • strides – sequence[int] a sequence of n integers, representing the inter-window strides (default: (1, …, 1)).

  • padding – str, sequence[int] either the string ‘SAME’, the string ‘VALID’, or a sequence of n (low, high) integer pairs that give the padding to apply before and after each spatial dimension (default: ‘VALID’).

Returns

The maximum for each window slice.

__init__(window_shape, strides=None, padding='VALID')[source]#

Pooling functions are implemented using the ReduceWindow XLA op.

Parameters
  • init_v – scalar the initial value for the reduction

  • reduce_fn – callable a reduce function of the form (T, T) -> T.

  • window_shape – tuple a shape tuple defining the window to reduce over.

  • strides – sequence[int] a sequence of n integers, representing the inter-window strides.

  • padding

    str, sequence[int]

    either the string ‘SAME’, the string ‘VALID’, or a sequence of n (low, high) integer pairs that give the padding to apply before and after each spatial dimension.

    Returns:

    The output of the reduction for each window slice.

Methods

__init__(window_shape[, strides, padding])

Pooling functions are implemented using the ReduceWindow XLA op.

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

rtype

Optional[TypeVar(Tensor, JaxArray, ndarray)]

feedback_shapes

Output data size.

feedforward_shapes

Input data size.

is_feedback_input_supported

is_feedback_supported

is_initialized

rtype

bool

name

output_shape

Output data size.

state

Node current internal state.

trainable

Returns if the Node can be trained.