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

[BUG]: Getting numpy error even though my tensors are marked PyTorch #757

Closed
s1ddok opened this issue Oct 8, 2024 · 0 comments
Closed

Comments

@s1ddok
Copy link

s1ddok commented Oct 8, 2024

Problem description

Receving this:

lib/python3.11/site-packages/torch/_subclasses/functional_tensor.py:258: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:84.)
  cpu = _conversion_method_template(device=torch.device("cpu"))

on the first call to function, even though my function returns this:

typedef nb::ndarray<nb::pytorch, float> PytorchNDArray;

nb::tuple foo(std::string& filename) {
   // logic
  return nb::make_tuple(
      nb::ndarray<nb::pytorch, float>(temp.data1, { temp.count, 3 }, deleter),
      nb::ndarray<nb::pytorch, float>(temp.data2, { temp.count, 3 }, deleter),
  );
}

Reproducible example code

No response

@s1ddok s1ddok closed this as completed Oct 17, 2024
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

1 participant