crested.tl.zoo.utils.AttentionPool1D#

class crested.tl.zoo.utils.AttentionPool1D(pool_size=2, per_channel=True, w_init_scale=2.0, strides=None, padding=None, data_format=None, name='AttentionPool1D', **kwargs)#

AttentionPool from the FastISM repository. Does learnable Softmax pooling, for use in Enformer.

Parameters:
  • pool_size (int (default: 2)) – Pooling size, same as in Max/AvgPooling.

  • per_channel (bool (default: True)) – If True, the logits/softmax weights will be computed for each channel separately. If False, same weights will be used across all channels.

  • w_init_scale (float (default: 2.0)) – Initialisation of w. When 0.0 is equivalent to avg pooling, and when ~2.0 and per_channel=False it’s equivalent to max pooling.

  • strides/padding/data_format – placeholder arguments to capture them from from_config. Not used in setting up the layer.

  • name (str (default: 'AttentionPool1D')) – Module name.

  • **kwargs – Extra arguments passed to keras.layers.Layer.

Attributes table#

Methods table#

build(inputs_shape)

Construct the learnable layer part of the module.

call(inputs[, training])

Calculate the AttentionPool result.

get_config()

Get the config for this layer.

Attributes#

Methods#

AttentionPool1D.build(inputs_shape)#

Construct the learnable layer part of the module.

Put in build to have access to input_shape when initializing layer.

AttentionPool1D.call(inputs, training=False)#

Calculate the AttentionPool result.

AttentionPool1D.get_config()#

Get the config for this layer.