egc.module.loss package
Submodules
egc.module.loss.contrastive_loss module
Contrastive Loss Adapted from https://github.com/Yunfan-Li/Contrastive-Clustering
- class egc.module.loss.contrastive_loss.InstanceLoss(batch_size, temperature)[source]
Bases:
ModuleInstance Contrastive Loss
- forward(z_i, z_j)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool
- class egc.module.loss.contrastive_loss.ClusterLoss(class_num, temperature)[source]
Bases:
ModuleCluster Contrastive Loss
- forward(c_i, c_j)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool
Module contents
Loss