{
  "$schema": "https://ambiqai.github.io/helia-ui/schema/reference-model-1.json",
  "generatedFrom": {
    "sourceCommit": "f341fb11f7f5d77a4974ba8273c4cd55d67c21f0",
    "tool": "pyref",
    "version": "1.7.3"
  },
  "language": "python",
  "modules": [
    {
      "description": "# SimCLR Loss\n\nThis module implements the SimCLR loss function for contrastive self-supervised learning.\n\n**Classes**\n\n| Name | Description |\n| --- | --- |\n| `SimCLRLoss` | Implements SimCLR Cosine Similarity loss. |\n\n**Functions**\n\n| Name | Description |\n| --- | --- |\n| `l2_normalize` | Normalizes a tensor along a given axis. |",
      "name": "simclr",
      "path": "helia_edge.losses.simclr",
      "submodules": [],
      "summary": "SimCLR Loss",
      "symbols": [
        {
          "description": "",
          "examples": [],
          "id": "helia_edge.losses.simclr.LARGE_NUM",
          "kind": "constant",
          "language": "python",
          "members": [],
          "name": "LARGE_NUM",
          "params": [],
          "raises": [],
          "returns": [],
          "signature": "LARGE_NUM = 1000000000.0",
          "source": {
            "line": 18,
            "path": "helia_edge/losses/simclr.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/losses/simclr.py#L18"
          },
          "summary": ""
        },
        {
          "description": "Performs L2 normalization on a tensor along a given axis.",
          "examples": [],
          "id": "helia_edge.losses.simclr.l2_normalize",
          "kind": "function",
          "language": "python",
          "members": [],
          "name": "l2_normalize",
          "params": [
            {
              "description": "Input tensor",
              "name": "x",
              "type": "tf.Tensor"
            },
            {
              "default": "None",
              "description": "Axis. Defaults to None.",
              "name": "axis",
              "type": "int | tuple[int]"
            }
          ],
          "raises": [],
          "returns": [
            {
              "description": "tf.Tensor: Normalized tensor",
              "type": "keras.KerasTensor"
            }
          ],
          "signature": "l2_normalize(x: keras.KerasTensor, axis: int | tuple[int, ...] | None = None) -> keras.KerasTensor",
          "source": {
            "line": 21,
            "path": "helia_edge/losses/simclr.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/losses/simclr.py#L21"
          },
          "summary": "Performs L2 normalization on a tensor along a given axis."
        },
        {
          "description": "Implements SimCLR Cosine Similarity loss.\n\nSimCLR loss is used for contrastive self-supervised learning.\n\n:::note[References]\n- [SimCLR paper](https://arxiv.org/pdf/2002.05709)\n\n:::",
          "examples": [],
          "id": "helia_edge.losses.simclr.SimCLRLoss",
          "kind": "class",
          "language": "python",
          "members": [
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.losses.simclr.SimCLRLoss.temperature",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "temperature",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "temperature = temperature",
              "source": {
                "line": 52,
                "path": "helia_edge/losses/simclr.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/losses/simclr.py#L52"
              },
              "summary": ""
            },
            {
              "description": "Computes SimCLR loss for a pair of projections in a contrastive\nlearning trainer.\n\nNote that unlike most loss functions, this should not be called with\ny_true and y_pred, but with two unlabeled projections. It can otherwise\nbe treated as a normal loss function.",
              "examples": [],
              "id": "helia_edge.losses.simclr.SimCLRLoss.call",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "call",
              "params": [
                {
                  "description": "a tensor with the output of the first projection\nmodel in a contrastive learning trainer",
                  "name": "projections_1",
                  "type": "keras.KerasTensor"
                },
                {
                  "description": "a tensor with the output of the second projection\nmodel in a contrastive learning trainer",
                  "name": "projections_2",
                  "type": "keras.KerasTensor"
                }
              ],
              "raises": [],
              "returns": [
                {
                  "description": "keras.KerasTensor: A tensor with the SimCLR loss computed from the input projections",
                  "type": "keras.KerasTensor"
                }
              ],
              "signature": "call(projections_1: keras.KerasTensor, projections_2: keras.KerasTensor) -> keras.KerasTensor",
              "source": {
                "line": 54,
                "path": "helia_edge/losses/simclr.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/losses/simclr.py#L54"
              },
              "summary": "Computes SimCLR loss for a pair of projections in a contrastive learning trainer."
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.losses.simclr.SimCLRLoss.get_config",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "get_config",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "get_config()",
              "source": {
                "line": 97,
                "path": "helia_edge/losses/simclr.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/losses/simclr.py#L97"
              },
              "summary": ""
            }
          ],
          "name": "SimCLRLoss",
          "params": [
            {
              "description": "A scaling factor for cosine similarity b/w [0, 1].",
              "name": "temperature",
              "type": "float"
            }
          ],
          "raises": [],
          "returns": [],
          "signature": "SimCLRLoss(temperature: float, **kwargs={})",
          "source": {
            "line": 37,
            "path": "helia_edge/losses/simclr.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/losses/simclr.py#L37"
          },
          "summary": "Implements SimCLR Cosine Similarity loss."
        }
      ]
    }
  ],
  "name": "helia_edge"
}
