Skip to content

Eaxmple in readme refers to function that doesn't appear to exist #1306

@owainkenwayucl

Description

@owainkenwayucl

In the Readme.md there is this example for eager mode:

import torch
import torch_ttnn

model = YourModel()

device = ttnn.open_device(device_id=0)
model.to(torch_ttnn.ttnn_device_as_torch_device(device))

output = model(input_data)

If you actually try to do this with a model you discover that torch_ttnn.tnn_device_as_torch_device() doesn't seem to exist.

(pytorch20-ttnn) ❄️  (uccaoke) venvs≫ python3
Python 3.10.12 (main, Nov  4 2025, 08:48:33) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> import ttnn
2025-11-29 22:18:13.054 | DEBUG    | ttnn:<module>:77 - Initial ttnn.CONFIG:
Config{cache_path=/home/uccaoke/.cache/ttnn,model_cache_path=/home/uccaoke/.cache/ttnn/models,tmp_dir=/tmp/ttnn,enable_model_cache=false,enable_fast_runtime_mode=true,throw_exception_on_fallback=false,enable_logging=false,enable_graph_report=false,enable_detailed_buffer_report=false,enable_detailed_tensor_report=false,enable_comparison_mode=false,comparison_mode_should_raise_exception=false,comparison_mode_pcc=0.9999,root_report_path=generated/ttnn/reports,report_name=std::nullopt,std::nullopt}
>>> import torch_ttnn
>>> device = ttnn.open_device(device_id=0)

( cut because way way too much output )

2025-11-29 22:19:53.752 | info     |             UMD | Mapped hugepage 0x2180000000 to NOC address 0x880000000 (sysmem_manager.cpp:247)
2025-11-29 22:19:53.752 | info     |             UMD | Pinning pages for Hugepage: virtual address 0x7f2480000000 and size 0x30000000 pinned to physical address 0x2140000000 and mapped to noc address 0x8c0000000 (pci_device.cpp:644)
2025-11-29 22:19:53.752 | info     |             UMD | Mapped hugepage 0x2140000000 to NOC address 0x8c0000000 (sysmem_manager.cpp:247)
2025-11-29 22:19:53.825 | info     |          Fabric | TopologyMapper mapping start (mesh=0): n_log=32, n_phys=32, log_deg_hist={2:4, 3:16, 4:12}, phys_deg_hist={4:32} (topology_mapper.cpp:574)
2025-11-29 22:19:54.112 | warning  |           Metal | Opening subset of mmio devices slows down UMD read/write to remote chips. If opening more devices, consider using CreateDevices API. (device_pool.cpp:303)
2025-11-29 22:19:54.113 | info     |           Metal | Profiler started on device 0 (device_pool.cpp:203)
>>> d = torch_ttnn.ttnn_device_as_torch_device(device)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'torch_ttnn' has no attribute 'ttnn_device_as_torch_device
>>>

I've done some poking through the code-base but I can't really see what this is meant to be...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions