68a978d4de27b6625870e1ea4242075e990922f4,examples/pytorch/jtnn/jtnn/nnutils.py,,cuda,#Any#,6

Before Change



def cuda(tensor):
    if torch.cuda.is_available() and not os.getenv("NOCUDA", None):
        return tensor.cuda()
    else:
        return tensor

After Change



def cuda(x):
    if torch.cuda.is_available() and not os.getenv("NOCUDA", None):
        return x.to(torch.device("cuda"))   // works for both DGLGraph and tensor
    else:
        return tensor
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: dmlc/dgl
Commit Name: 68a978d4de27b6625870e1ea4242075e990922f4
Time: 2020-07-29
Author: coin2028@hotmail.com
File Name: examples/pytorch/jtnn/jtnn/nnutils.py
Class Name:
Method Name: cuda


Project Name: dnouri/skorch
Commit Name: 3ae81201f7fcf7affa276ae2fbd632c58ebf49ce
Time: 2018-10-23
Author: benjamin.bossan@ottogroup.com
File Name: skorch/net.py
Class Name: NeuralNet
Method Name: _get_state_dict


Project Name: pyannote/pyannote-audio
Commit Name: 23b0c697b44c4b8dccf7c31503c067e608bba64f
Time: 2018-06-29
Author: bredin@limsi.fr
File Name: pyannote/audio/embedding/extraction.py
Class Name: SequenceEmbedding
Method Name: postprocess_ndarray