ExTorch.Export.OpRegistry
(extorch v0.4.0)
Copy Markdown
Registry for custom ExTorch.Export.OpHandler modules.
Maps op target strings to handler modules so ExTorch.Export can dispatch
to external op implementations at both compile time (load) and runtime
(forward).
Handlers are registered in two ways:
Config (loaded at first access):
config :extorch, :export_op_handlers, [MyApp.VisionOps]
Runtime:
ExTorch.Export.OpRegistry.register(MyApp.VisionOps)
The registry is backed by a persistent_term for fast concurrent reads.
Summary
Functions
Look up the handler module for a given op target string.
Register an ExTorch.Export.OpHandler module.
Remove all registered handlers and reset the dispatch table.
Returns the full dispatch table as a %{op_target => handler_module} map.
Functions
Look up the handler module for a given op target string.
Returns {:ok, handler_module} or :error.
@spec register(module()) :: :ok
Register an ExTorch.Export.OpHandler module.
Merges the handler's ops into the dispatch table. If an op is already registered by another handler, the new handler takes precedence.
@spec reset() :: :ok
Remove all registered handlers and reset the dispatch table.
Returns the full dispatch table as a %{op_target => handler_module} map.