-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add equal op for ascend * add unittest for equal op * add unittest for equal op * add unittest for equal op * add unittest for equal op * add torch.equal to dipu * Update diopi_functions.yaml
- Loading branch information
1 parent
5afa987
commit 2ce08a7
Showing
5 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,7 @@ diopiEq | |
diopiEqInp | ||
diopiEqInpScalar | ||
diopiEqScalar | ||
diopiEqual | ||
diopiErfinv | ||
diopiErfinvInp | ||
diopiExp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright (c) 2023, DeepLink. | ||
import torch | ||
import math | ||
import torch_dipu | ||
from torch_dipu.testing._internal.common_utils import TestCase, run_tests, onlyOn | ||
|
||
|
||
class TestEqual(TestCase): | ||
@onlyOn("NPU") | ||
def test_equal_1(self): | ||
device = torch.device("dipu") | ||
x = torch.rand(3, 4).to(device) | ||
self.assertEqual(True, torch.equal(x, x)) | ||
|
||
@onlyOn("NPU") | ||
def test_equal_2(self): | ||
device = torch.device("dipu") | ||
x = torch.rand(3, 4).to(device) | ||
self.assertEqual(False, torch.equal(x, x.to(torch.float16))) | ||
|
||
@onlyOn("NPU") | ||
def test_equal_3(self): | ||
device = torch.device("dipu") | ||
x = torch.zeros(3, 4).to(device) | ||
self.assertEqual(True, torch.equal(x, x.to(torch.float16))) | ||
|
||
@onlyOn("NPU") | ||
def test_equal_4(self): | ||
device = torch.device("dipu") | ||
x = torch.rand(3, 4).to(device) | ||
y = torch.rand(3, 5).to(device) | ||
self.assertEqual(False, torch.equal(x, y)) | ||
|
||
|
||
if __name__ == "__main__": | ||
run_tests() |
Submodule DIOPI
updated
7 files