{
  "$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": "# Spectral Layers API\n\n**Classes**\n\n| Name | Description |\n| --- | --- |\n| `StftMagnitude` | Magnitude of a short-time Fourier transform with a fixed, stored basis |\n\n**Functions**\n\n| Name | Description |\n| --- | --- |\n| `max_projection` | Magnitude of complex values without a square root, within 0.25% |",
      "name": "spectral",
      "path": "helia_edge.layers.spectral",
      "submodules": [],
      "summary": "Spectral Layers API",
      "symbols": [
        {
          "description": "",
          "examples": [],
          "id": "helia_edge.layers.spectral.DIRECTIONS",
          "kind": "constant",
          "language": "python",
          "members": [],
          "name": "DIRECTIONS",
          "params": [],
          "raises": [],
          "returns": [],
          "signature": "DIRECTIONS = 9",
          "source": {
            "line": 16,
            "path": "helia_edge/layers/spectral.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/spectral.py#L16"
          },
          "summary": ""
        },
        {
          "description": "Magnitude of complex values as the largest of 9 projections of (|re|, |im|), within 0.25% in float32.\n\nThe directions are spread from 0 to 90 degrees and scaled so the error is centred: the result is\nwithin -0.25% and +0.25% of ``sqrt(re**2 + im**2)``. It needs no square root, so integer kernels\nrun it.",
          "examples": [],
          "id": "helia_edge.layers.spectral.max_projection",
          "kind": "function",
          "language": "python",
          "members": [],
          "name": "max_projection",
          "params": [
            {
              "description": "Real and imaginary parts on the last axis, ``(..., 2)``, rank 4.",
              "name": "pairs"
            }
          ],
          "raises": [],
          "returns": [
            {
              "description": "The magnitudes, ``(...)``."
            }
          ],
          "signature": "max_projection(pairs)",
          "source": {
            "line": 19,
            "path": "helia_edge/layers/spectral.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/spectral.py#L19"
          },
          "summary": "Magnitude of complex values as the largest of 9 projections of (|re|, |im|), within 0.25% in float32."
        },
        {
          "description": "Magnitude of a short-time Fourier transform computed as a strided convolution with a stored basis.\n\nThe input ``(batch, samples)`` is reflect-padded by ``padding`` (start, end) samples and convolved\nwith ``basis`` (``frame_length`` taps, ``frame_step`` stride, ``2 * bins`` filters: the real parts of\nevery bin, then the imaginary parts). The output is the magnitude of shape ``(batch, frames, bins)``:\n``sqrt(re**2 + im**2)``, or ``max_projection`` of (re, im). The basis is a non-trainable weight, so a\nmodel's window and transform travel with its weights.",
          "examples": [],
          "id": "helia_edge.layers.spectral.StftMagnitude",
          "kind": "class",
          "language": "python",
          "members": [
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.layers.spectral.StftMagnitude.frame_length",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "frame_length",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "frame_length = frame_length",
              "source": {
                "line": 69,
                "path": "helia_edge/layers/spectral.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/spectral.py#L69"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.layers.spectral.StftMagnitude.frame_step",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "frame_step",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "frame_step = frame_step",
              "source": {
                "line": 70,
                "path": "helia_edge/layers/spectral.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/spectral.py#L70"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.layers.spectral.StftMagnitude.bins",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "bins",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "bins = bins",
              "source": {
                "line": 71,
                "path": "helia_edge/layers/spectral.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/spectral.py#L71"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.layers.spectral.StftMagnitude.padding",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "padding",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "padding = tuple(padding)",
              "source": {
                "line": 72,
                "path": "helia_edge/layers/spectral.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/spectral.py#L72"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.layers.spectral.StftMagnitude.magnitude",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "magnitude",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "magnitude = magnitude",
              "source": {
                "line": 73,
                "path": "helia_edge/layers/spectral.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/spectral.py#L73"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.layers.spectral.StftMagnitude.build",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "build",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "build(input_shape)",
              "source": {
                "line": 75,
                "path": "helia_edge/layers/spectral.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/spectral.py#L75"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.layers.spectral.StftMagnitude.call",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "call",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "call(x)",
              "source": {
                "line": 80,
                "path": "helia_edge/layers/spectral.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/spectral.py#L80"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.layers.spectral.StftMagnitude.compute_output_shape",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "compute_output_shape",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "compute_output_shape(input_shape)",
              "source": {
                "line": 89,
                "path": "helia_edge/layers/spectral.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/spectral.py#L89"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.layers.spectral.StftMagnitude.get_config",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "get_config",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "get_config()",
              "source": {
                "line": 95,
                "path": "helia_edge/layers/spectral.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/spectral.py#L95"
              },
              "summary": ""
            }
          ],
          "name": "StftMagnitude",
          "params": [
            {
              "description": "Samples per frame.",
              "name": "frame_length",
              "type": "int"
            },
            {
              "description": "Samples between frames.",
              "name": "frame_step",
              "type": "int"
            },
            {
              "description": "Frequency bins.",
              "name": "bins",
              "type": "int"
            },
            {
              "default": "(0, 0)",
              "description": "Samples of reflect padding before the first and after the last sample.",
              "name": "padding",
              "type": "tuple[int, int]"
            },
            {
              "default": "'sqrt'",
              "description": "``sqrt`` (exact) or ``max_projection`` (no square root, within 0.25%).",
              "name": "magnitude",
              "type": "str"
            }
          ],
          "raises": [],
          "returns": [],
          "signature": "StftMagnitude(\n    frame_length: int,\n    frame_step: int,\n    bins: int,\n    padding: tuple[int, int] = (0, 0),\n    magnitude: str = 'sqrt',\n    **kwargs={},\n)",
          "source": {
            "line": 39,
            "path": "helia_edge/layers/spectral.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/spectral.py#L39"
          },
          "summary": "Magnitude of a short-time Fourier transform computed as a strided convolution with a stored basis."
        }
      ]
    }
  ],
  "name": "helia_edge"
}
