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

Error in utils.py #1

Open
QuickLearner171998 opened this issue Feb 13, 2020 · 0 comments
Open

Error in utils.py #1

QuickLearner171998 opened this issue Feb 13, 2020 · 0 comments

Comments

@QuickLearner171998
Copy link

Hi, I tried running the Retrosynthesis Reaction Planning.ipynb notebook. I am getting this error:

RuntimeError:
builtin cannot be used as a value:
at /usr/local/lib/python3.6/dist-packages/torchvision/models/detection/_utils.py:14:56
def zeros_like(tensor, dtype):
# type: (Tensor, int) -> Tensor
return torch.zeros_like(tensor, dtype=dtype, layout=tensor.layout,
~~~~~~~~~~~~~ <--- HERE
device=tensor.device, pin_memory=tensor.is_pinned())
'zeros_like' is being compiled since it was called from 'torch.torchvision.models.detection._utils.BalancedPositiveNegativeSampler.call'
at /usr/local/lib/python3.6/dist-packages/torchvision/models/detection/_utils.py:72:12

        # randomly select positive and negative examples
        perm1 = torch.randperm(positive.numel(), device=positive.device)[:num_pos]
        perm2 = torch.randperm(negative.numel(), device=negative.device)[:num_neg]

        pos_idx_per_image = positive[perm1]
        neg_idx_per_image = negative[perm2]

        # create binary mask from indices
        pos_idx_per_image_mask = zeros_like(
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...  <--- HERE
            matched_idxs_per_image, dtype=torch.uint8
        )
        neg_idx_per_image_mask = zeros_like(
            matched_idxs_per_image, dtype=torch.uint8
        )

        pos_idx_per_image_mask[pos_idx_per_image] = torch.tensor(1, dtype=torch.uint8)
        neg_idx_per_image_mask[neg_idx_per_image] = torch.tensor(1, dtype=torch.uint8)
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