Skip to main content

CompiledFunction

Wraps a callable: the first call serves the eager result and records the graph; later shape-matching calls run the graph. Every call returns exactly what the eager function would.

kMaxRecaptures (property)

(arg: object, /) -> int

recapture_count (property)

How many times drifted input shapes forced a re-capture.

state (property)

Where the function is in its capture lifecycle (Pending / Compiled / Fallback).

State

State(*values)

Create a collection of name/value pairs.

Example enumeration:

class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3

Access them by:

  • attribute access:

    Color.RED <Color.RED: 1>

  • value lookup:

    Color(1) <Color.RED: 1>

  • name lookup:

    Color['RED'] <Color.RED: 1>

Enumerations can be iterated over, and know how many members they have:

len(Color) 3

list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details.

__init__

__init__(self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

reset

resetreset(self) -> None

reset(self) -> None

Re-arm capture: back to Pending, dropping the captured graph and the re-capture count.

take_graph

take_graphtake_graph(self) -> clika_runtime._core.io.ModelGraph

take_graph(self) -> clika_runtime._core.io.ModelGraph

Take the captured ModelGraph out of the function (Compiled state only); afterwards the function serves eagerly until reset().