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

MUSAExtension扩展包导入失败 #53

Open
gtgtgt1117 opened this issue Jul 3, 2024 · 1 comment
Open

MUSAExtension扩展包导入失败 #53

gtgtgt1117 opened this issue Jul 3, 2024 · 1 comment

Comments

@gtgtgt1117
Copy link

参考示例脚本替换为自己得mu和cpp文件,
image

python导入时报错如下:
image
包版本如下:
setuptools 68.2.2
torch 2.0.0
torch-musa 1.1.0
torchaudio 2.0.1+3b40834
torchvision 0.15.2a0+fa99a53

@zehan-mt
Copy link

请这样使用,

import torch
import torch_musa
from freqencoder import FreqEncoder
view_encoder = FreqEncoder(input_dim=3, degree=4)
dirs_musa = torch.tensor([[1.1,2.2,3.3],[4.4,5.5,6.6]], requires_grad=True, device="musa")

def compute(dirs):
    dirs_ = dirs/dirs.norm(dim=-1,keepdim=True)
    code = view_encoder(dirs_)
    loss = code.mean()
    loss.backward()
    return code

print(compute(dirs_musa), dirs_musa.grad)

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

No branches or pull requests

2 participants