6def46044be4f04b45704562396b39108ec12bf0,lib/model/rpn/proposal_target_layer_4.py,_ProposalTargetLayer,_sample_rois_pytorch,#_ProposalTargetLayer#Any#Any#Any#Any#Any#,117

Before Change



                // sampling bg
                bg_rois_per_this_image = rois_per_image - fg_rois_per_this_image
                rand_num = torch.floor(torch.rand(bg_rois_per_this_image).type_as(all_rois)
                                         * bg_num_rois).long()
                bg_inds = bg_inds[rand_num]
            elif fg_num_rois > 0 and bg_num_rois == 0:
                // sampling fg
                rand_num = torch.floor(torch.rand(rois_per_image).type_as(all_rois)

After Change


                // Seems torch.rand has a bug, it will generate very large number and make an error. 
                // We use numpy rand instead. 
                //rand_num = (torch.rand(bg_rois_per_this_image) * bg_num_rois).long().cuda()
                rand_num = np.floor(np.random.rand(bg_rois_per_this_image) * bg_num_rois)
                rand_num = torch.from_numpy(rand_num).long().cuda()
                bg_inds = bg_inds[rand_num]

            elif fg_num_rois > 0 and bg_num_rois == 0:
                // sampling fg
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: jwyang/faster-rcnn.pytorch
Commit Name: 6def46044be4f04b45704562396b39108ec12bf0
Time: 2017-08-30
Author: echosenm@gmail.com
File Name: lib/model/rpn/proposal_target_layer_4.py
Class Name: _ProposalTargetLayer
Method Name: _sample_rois_pytorch


Project Name: facebookresearch/ParlAI
Commit Name: 1a6f95dc2d715783b358f4bca267d099efd3ac31
Time: 2020-06-09
Author: roller@fb.com
File Name: parlai/core/torch_generator_agent.py
Class Name: TorchGeneratorAgent
Method Name: _dummy_batch


Project Name: ixaxaar/pytorch-dnc
Commit Name: 049c293a83ba05d11956568a5c1835757a09e4ef
Time: 2017-11-30
Author: root@ixaxaar.in
File Name: test/test_indexes.py
Class Name:
Method Name: test_indexes