compile¶
torch_tvarant.compiler.compile(module, *, dynamic=False) → Callable
Compile a module for Tvarant inference.
Prefers FX tracing that inlines Linear / activations (stable on this custom
device). Falls back to torch.compile(..., backend="tvarant").
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
Module
|
Module to optimize. Switched to |
required |
dynamic
|
bool
|
Forwarded to |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
Callable |
Callable
|
Callable module / optimized callable producing the same |
Callable
|
outputs as |
Examples:
>>> compiled = torch_tvarant.compiler.compile(model)
>>> y = compiled(x)
Source code in torch_tvarant/compiler.py
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | |