Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Torch.nn.functional.one_hot does not work as expected with ROCM #1238

Open
akichinguyen opened this issue Jun 8, 2023 · 1 comment
Open

Comments

@akichinguyen
Copy link

🐛 Describe the bug

I installed the pytorch 2.1 with rocm 5.4.2.
When I tested the one_hot function, it returned this:
print(torch.nn.functional.one_hot(torch.tensor(0,device=‘cuda:0’), 2)) = [0,0]

Do you know why it behaved like this? Thank you in advance

Versions

PyTorch version: 2.1.0.dev20230607+rocm5.4.2
Is debug build: False
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: 5.4.22803-474e8620

OS: Rocky Linux release 8.7 (Green Obsidian) Red Hat Enterprise Linux (x86_64)
GCC version: (GCC) 8.5.0 20210514 (Red Hat 8.5.0-16)
Clang version: 15.0.0 (https://github.com/RadeonOpenCompute/llvm-project roc-5.4.3 23045 a29fe425c7b0e5aba97ed2f95f61fd5ecba68aed)
CMake version: version 3.26.3
Libc version: glibc-2.28

Python version: 3.10.4 (main, Mar 31 2022, 08:41:55) [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-4.18.0-425.3.1.el8.x86_64-x86_64-with-glibc2.28
Is CUDA available: True
CUDA runtime version: 11.3.58
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: AMD Instinct MI210
Nvidia driver version: Could not collect
cuDNN version: Could not collect
HIP runtime version: 5.4.22803
MIOpen runtime version: 2.19.0
Is XNNPACK available: True

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 96
On-line CPU(s) list: 0-95
Thread(s) per core: 1
Core(s) per socket: 24
Socket(s): 4
NUMA node(s): 4
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Platinum 8360H CPU @ 3.00GHz
Stepping: 11
CPU MHz: 3896.590
CPU max MHz: 4200.0000
CPU min MHz: 1200.0000
BogoMIPS: 5994.75
L1d cache: 32K
L1i cache: 32K
L2 cache: 1024K
L3 cache: 33792K
NUMA node0 CPU(s): 0-23
NUMA node1 CPU(s): 24-47
NUMA node2 CPU(s): 48-71
NUMA node3 CPU(s): 72-95
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local avx512_bf16 dtherm ida arat pln pts pku ospke avx512_vnni md_clear flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] pytorch-lightning==2.0.2
[pip3] torch==2.1.0.dev20230607+rocm5.4.2
[pip3] torchaudio==2.1.0.dev20230607+rocm5.4.2
[pip3] torchmetrics==0.11.4
[pip3] torchvision==0.16.0.dev20230607+rocm5.4.2
[pip3] triton==2.0.0
[conda] numpy 1.23.5 pypi_0 pypi
[conda] pytorch-lightning 2.0.2 pypi_0 pypi
[conda] torch 2.1.0.dev20230607+rocm5.4.2 pypi_0 pypi
[conda] torchaudio 2.1.0.dev20230607+rocm5.4.2 pypi_0 pypi
[conda] torchmetrics 0.11.4 pypi_0 pypi
[conda] torchvision 0.16.0.dev20230607+rocm5.4.2 pypi_0 pypi
[conda] triton 2.0.0 pypi_0 pypi

@taylding-amd
Copy link

Hi @akichinguyen, I was unable to reproduce the unexpected result you mentioned. Here’s what I obtained instead:
image

Do you mind trying again with the latest release? For your reference, I used the PyTorch Docker, and you can find the instructions here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants