Skip to content

Instantly share code, notes, and snippets.

@Shmuma
Created October 2, 2017 08:40
Show Gist options
  • Save Shmuma/97c7482cab4b0105c96de3ccd383c87f to your computer and use it in GitHub Desktop.
Save Shmuma/97c7482cab4b0105c96de3ccd383c87f to your computer and use it in GitHub Desktop.
PyTorch byte Variable overflow
>>> import torch
>>> from torch.autograd import Variable
>>> t = torch.ByteTensor([240, 240])
>>> t.sum()
480
>>> v = Variable(t)
>>> v
Variable containing:
240
240
[torch.ByteTensor of size 2]
>>> v.sum()
Variable containing:
224
[torch.ByteTensor of size 1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment