{
  "$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": "# FLOPs Metrics API\n\nFLOPS calculation for keras.Model or keras.Sequential.\n\n**Functions**\n\n| Name | Description |\n| --- | --- |\n| `get_flops` | Calculate FLOPS for keras.Model or keras.Sequential |",
      "name": "flops",
      "path": "helia_edge.metrics.flops",
      "submodules": [],
      "summary": "FLOPs Metrics API",
      "symbols": [
        {
          "description": "Calculate FLOPS for keras.Model or keras.Sequential.\nIgnore operations used in only training mode such as Initialization.\n\n:::note\nOnly tensorflow backend is supported currently.\nDoes not support LSTM and GRU.\n\n:::\n\nExample:\n\n```python\nmodel = keras.Sequential([\n    keras.layers.Dense(128, activation=\"relu\", input_shape=(784,)),\n    keras.layers.Dense(64, activation=\"relu\"),\n    keras.layers.Dense(10, activation=\"softmax\"),\n])\nimport helia_edge as helia\n\nmodel.build()\nflops = helia.metrics.get_flops(model, batch_size=1)\nprint(f\"FLOPS: {flops/1e6:.2f}M\")\n```",
          "examples": [],
          "id": "helia_edge.metrics.flops.get_flops",
          "kind": "function",
          "language": "python",
          "members": [],
          "name": "get_flops",
          "params": [
            {
              "description": "Model",
              "name": "model",
              "type": "keras.Model | keras.Sequential"
            },
            {
              "default": "None",
              "description": "Batch size. Defaults to None.",
              "name": "batch_size",
              "type": "int"
            },
            {
              "default": "None",
              "description": "Output file path. Defaults to None.",
              "name": "fpath",
              "type": "os.PathLike"
            }
          ],
          "raises": [],
          "returns": [
            {
              "description": "FLOPS",
              "name": "float",
              "type": "float"
            }
          ],
          "signature": "get_flops(model: keras.Model, batch_size: int | None = None, fpath: os.PathLike | None = None) -> float",
          "source": {
            "line": 17,
            "path": "helia_edge/metrics/flops.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/metrics/flops.py#L17"
          },
          "summary": "Calculate FLOPS for keras.Model or keras.Sequential."
        }
      ]
    }
  ],
  "name": "helia_edge"
}
