src.model.deeplearn.layer.torf_masked_fill_layer

Classes

TORFMaskedFillLayer(*args, **kwargs)

class src.model.deeplearn.layer.torf_masked_fill_layer.TORFMaskedFillLayer(*args, **kwargs)
Author:

Alberto M. Esmoris Pena

Apply a float mask to a tensor, filling invalid (zero-mask) positions with a large negative value so they are ignored by a subsequent max reduction.

Given tensors [X, M] where M contains 0/1 floats:

\[f(\mathbf{X}, \mathbf{M}) = \mathbf{X} \odot \mathbf{M} + (1 - \mathbf{M}) \cdot v_{\text{fill}}\]
Variables:

fill_value (float) – Value written into masked-out positions.

__init__(fill_value=-1000000000.0, **kwargs)

See Layer and Layer.__init__().

call(inputs, training=False, mask=False)

Apply masked fill.

Parameters:

inputs – List of two tensors [X, M] where M is a float mask with the same broadcastable shape as X.

Returns:

The masked tensor.

get_config()

Return necessary data to deserialize the layer.

classmethod from_config(config)

Use given config data to deserialize the layer.