f41ae3bce45a4cf2f101d610704838d335b1f586,tensorly/backend/pytorch_backend.py,,where,#Any#Any#Any#,101

Before Change


    out_ = out.view(N)

    for i in range(N):
        out_[i] = x_[i] if condition_[i] else y_[i]
    return out

After Change



def where(condition, x, y):
    assert condition.shape == x.shape == y.shape, "Dimension mismatch"
    result = zeros_like(condition, **context(x))
    result[condition] = x
    result[~condition] = y
    return result
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: tensorly/tensorly
Commit Name: f41ae3bce45a4cf2f101d610704838d335b1f586
Time: 2018-02-03
Author: csw@amazon.com
File Name: tensorly/backend/pytorch_backend.py
Class Name:
Method Name: where


Project Name: tensorly/tensorly
Commit Name: cdf6bdb308cd9a24c203029ae641143545ead9a3
Time: 2020-12-22
Author: ameyer@ucla.edu
File Name: tensorly/decomposition/_nn_cp.py
Class Name:
Method Name: initialize_nn_cp


Project Name: pantsbuild/pants
Commit Name: d71c53e4ef8c779d08afe546adb820618335f5f1
Time: 2015-02-27
Author: benjyw@gmail.com
File Name: tests/python/pants_test/tasks/test_jar_publish.py
Class Name: JarPublishTest
Method Name: test_publish_retry_eventually_fails


Project Name: pantsbuild/pants
Commit Name: d71c53e4ef8c779d08afe546adb820618335f5f1
Time: 2015-02-27
Author: benjyw@gmail.com
File Name: tests/python/pants_test/tasks/test_jar_publish.py
Class Name: JarPublishTest
Method Name: test_publish_retry_works