Base Bridge



polyaxon.bridges.base.BaseBridge(mode, state_size, name='Bridge')

An abstract base class for defining a bridge.

A bridge defines how state is passed between encoder and decoder.

  • Args:
    • mode: str. Specifies if this training, evaluation or prediction. See Modes.
    • name: str. The name of this bridge, used for creating the scope.
    • state_size: int. The bridge state size.


encode(self, incoming, encoder_fn)

Encodes the incoming tensor.

  • Args:
    • incoming: Tensor.
    • encoder_fn: function.
    • *args:
    • **kwargs:


decode(self, incoming, decoder_fn)

Decodes the incoming tensor if it's validates against the state size of the decoder. Otherwise, generates a random value.

  • Args:
    • incoming: Tensor
    • decoder_fn: function.
    • *args:
    • **kwargs:


_get_decoder_shape(self, incoming)

Returns the decoder expected shape based on the incoming tensor.


_build(self, incoming, loss_config, encoder_fn, decoder_fn)

Subclasses should implement their logic here and must return a BridgeSpec.