443a431ac35b19d5948f5dcb7bce1a2e7b1034a7,test/test_foreach.py,TestForeach,test_float_scalarlist,#TestForeach#Any#Any#,472
Before Change
// Bool case
if dtype == torch.bool:
if foreach_bin_op == torch._foreach_sub:
with self.assertRaisesRegex(RuntimeError, "Subtraction, the `-` operator, with a bool tensor"):
expected = [torch_bin_op(t, s) for t, s in zip(tensors, scalars)]
with self.assertRaisesRegex(RuntimeError, "Subtraction, the `-` operator, with a bool tensor"):
res = foreach_bin_op(tensors, scalars)
with self.assertRaisesRegex(RuntimeError, "Subtraction, the `-` operator, with a bool tensor"):
[t.sub_(scalar) for t, scalar in zip(tensors, scalars)]
with self.assertRaisesRegex(RuntimeError, "Subtraction, the `-` operator, with a bool tensor"):
foreach_bin_op_(tensors, scalars)
continue
res = foreach_bin_op(tensors, scalars)
expected = [torch_bin_op(t, s) for t, s in zip(tensors, scalars)]
self.assertEqual(res, expected)
After Change
if dtype in torch.testing.integral_types() and self.device_type == "cuda":
// see TODO[Fix scalar list]
self.assertEqual(res, [e.to(dtype) for e in expected])
foreach_bin_op_(tensors, scalars)
self.assertEqual(tensors, res)
return
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 4
Instances Project Name: pytorch/pytorch
Commit Name: 443a431ac35b19d5948f5dcb7bce1a2e7b1034a7
Time: 2021-02-03
Author: ngimel@fb.com
File Name: test/test_foreach.py
Class Name: TestForeach
Method Name: test_float_scalarlist
Project Name: IndicoDataSolutions/finetune
Commit Name: 63bde2f7cf28dbf6bca6e77fe0b0a9966dc6aee6
Time: 2020-05-14
Author: benlt@hotmail.co.uk
File Name: finetune/target_models/document_labeling.py
Class Name: DocumentPipeline
Method Name: _text_to_ids
Project Name: OpenNMT/OpenNMT-py
Commit Name: d105c9822eebac1882e6c6af13d352fb40f9264b
Time: 2017-11-14
Author: dengyuntian@gmail.com
File Name: onmt/IO.py
Class Name: ONMTDataset
Method Name: _read_img_file
Project Name: Kamnitsask/deepmedic
Commit Name: 6e670b4c66cd96a347e72f14e9380b0606515083
Time: 2019-05-26
Author: konstantinos.kamnitsas12@imperial.ac.uk
File Name: deepmedic/dataManagement/sampling.py
Class Name:
Method Name: load_subj_and_get_samples