Menu

Module providing Consciousness Exploration Tools for PyTorch.

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the gallery for the big picture.

class consciousnet.models.BarlowTwins(model, fc_layer_name, fc_in_features, projector, batch_size, lambd)[source]

Barlow Twins: Self-Supervised Learning via Redundancy Reduction.

__init__(model, fc_layer_name, fc_in_features, projector, batch_size, lambd)[source]

Init class.

Parameters

model : nn.model

the classification network.

fc_layer_name : str

the name of the fully conencted layer that will be replaced during the optimization by a projection head.

fc_in_features : int

the fully connected input features dimension.

projector : str

the MLP layers projector definition of the form 120-120-120.

batch_size : int

the mini-batch size.

lambd : float

the weight applied on off-diagonal terms.

forward(y1, y2)[source]

The forward method.

Parameters

y1, y2 : Tensors

the contrasted input data.

Returns

loss : float

the summed cross-correlation matrix.

Follow us

© 2021, consciousnet developers