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] Warning for return statement in get_periods method #36

Open
sundarjhu opened this issue Aug 27, 2023 · 0 comments
Open

[BUG] Warning for return statement in get_periods method #36

sundarjhu opened this issue Aug 27, 2023 · 0 comments

Comments

@sundarjhu
Copy link
Collaborator

Describe the bug

/Volumes/SSD2TBShaanpatiKhan/MovedHomeFolder/sundar/work/pgmuvi/pgmuvi/lightcurve.py:1349: UserWarning: Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with numpy.array() before converting to a tensor. (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/torch/csrc/utils/tensor_new.cpp:248.)
  return torch.as_tensor(periods), torch.as_tensor(weights), torch.as_tensor(scales)  # noqa: E501

While weights is a list of torch.Tensors, periods and scales are lists of np.ndarrays, which seems to be source of the warning.

To Reproduce
Fitting a 300-element light curve resulted in this warning.

Fix
adding the following lines before the return statement seems to fix things:

periods = np.array(periods)
scales = np.array(scales)
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