Hi Francois!



 Francois:

Applying RoIAlign (torchvision.ops.RoIAlign) on rois that is a tensor of shape (K, 5) results in a segfault : Process finished with exit code 139 (interrupted by signal 11: SIGSEGV).
Expected behavior, to run : docker run  docker run debug-torch:v0 results with:
[tensor([[1.4164, 0.2379, 0.9334, 1.1331],
        [0.3530, 2.0928, 0.6356, 1.5069],
        [0.9527, 1.0599, 0.9549, 1.3355],
        [0.5251, 0.7416, 0.4269, 0.4008],
        [0.7872, 0.0834, 1.1256, 1.5490]])]
torch.Size([5, 64, 3, 3])



I can’t reproduce your issue running a tweaked version of your code
by pasting it into a python interpreter running with torch / torchvision
versions 1.9.0 / 0.10.0:
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import argparse
>>>
>>> import torch
>>> from torchvision.ops import RoIAlign
>>>
>>> NB_ROI_PER_DOC = 5
>>>
>>> if __name__ == "__main__":
...
...     torch.manual_seed(0)
...
...     parser = argparse.ArgumentParser(description='minimum reproducible example')
...     parser.add_argument('--bug', action='store_true', default=False, help='toggle on the issue')
...     parser.add_argument('--batch-size', type=int, default=1)
...     parser.add_argument('--input-size', type=str, default="64,10,10")
...     args = parser.parse_args()
...
...     align = RoIAlign((3, 3), spatial_scale=14 / 224, sampling_ratio=2)
...     batch_size = args.batch_size
...     input_ = torch.randn((batch_size, *(int(dim) for dim in args.input_size.split(","))))
...     rois = [torch.abs(torch.randn(NB_ROI_PER_DOC, 4)) for _ in input_]
...
...     args.bug = True
...     if args.bug:
...         print ('args.bug =', args.bug)
...         nb_rois = NB_ROI_PER_DOC * batch_size
...         boxes = torch.abs(torch.randn(nb_rois, 4))
...         roi_ids = torch.arange(nb_rois).view(-1, 1)
...         rois = torch.cat((roi_ids, boxes), dim=1)
...
...     output = align(input=input_, rois=rois)
...     print(rois)
...     print(output.shape)
...
<torch._C.Generator object at 0x000002C110C51978>
_StoreTrueAction(option_strings=['--bug'], dest='bug', nargs=0, const=True, default=False, type=None, choices=None, help='toggle on the issue', metavar=None)
_StoreAction(option_strings=['--batch-size'], dest='batch_size', nargs=None, const=None, default=1, type=<class 'int'>, choices=None, help=None, metavar=None)
_StoreAction(option_strings=['--input-size'], dest='input_size', nargs=None, const=None, default='64,10,10', type=<class 'str'>, choices=None, help=None, metavar=None)
args.bug = True
tensor([[0.0000, 0.7319, 1.0969, 0.6430, 0.8533],
        [1.0000, 1.2892, 0.2074, 0.4249, 0.0755],
        [2.0000, 1.9148, 2.2872, 0.1998, 0.9350],
        [3.0000, 0.5617, 0.9486, 1.7332, 0.7013],
        [4.0000, 0.1312, 3.0198, 1.7909, 0.4429]])
torch.Size([5, 64, 3, 3])
>>> print (torch.__version__)
1.9.0
>>> import torchvision
>>> print (torchvision.__version__)
0.10.0

Are you expecting this to be some kind of docker / configuration /
hardware issue, or do you think it’s a pure pytorch issue?  I don’t see
it with my test.  What versions of torch / torchvision are you using?
Can you reproduce your issue with a “raw” python / pytorch installation,
or does in only happen when you use docker?
Best.
K. Frank