Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jerrrrry
infinicore
Commits
61a7dc0e
Commit
61a7dc0e
authored
Nov 24, 2025
by
wooway777
Browse files
issue/666 - Standardized test imports
parent
406c9668
Changes
268
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
165 additions
and
93 deletions
+165
-93
test/infinicore/ops/max_unpool2d.py
test/infinicore/ops/max_unpool2d.py
+63
-26
test/infinicore/ops/max_unpool3d.py
test/infinicore/ops/max_unpool3d.py
+24
-21
test/infinicore/ops/maximum.py
test/infinicore/ops/maximum.py
+7
-3
test/infinicore/ops/mean.py
test/infinicore/ops/mean.py
+7
-3
test/infinicore/ops/median.py
test/infinicore/ops/median.py
+7
-3
test/infinicore/ops/min.py
test/infinicore/ops/min.py
+7
-3
test/infinicore/ops/minimum.py
test/infinicore/ops/minimum.py
+7
-3
test/infinicore/ops/mish.py
test/infinicore/ops/mish.py
+7
-3
test/infinicore/ops/mse_loss.py
test/infinicore/ops/mse_loss.py
+1
-2
test/infinicore/ops/msort.py
test/infinicore/ops/msort.py
+7
-3
test/infinicore/ops/mul.py
test/infinicore/ops/mul.py
+7
-3
test/infinicore/ops/multi_margin_loss.py
test/infinicore/ops/multi_margin_loss.py
+1
-2
test/infinicore/ops/multilabel_margin_loss.py
test/infinicore/ops/multilabel_margin_loss.py
+1
-2
test/infinicore/ops/multilabel_soft_margin_loss.py
test/infinicore/ops/multilabel_soft_margin_loss.py
+1
-2
test/infinicore/ops/mv.py
test/infinicore/ops/mv.py
+7
-3
test/infinicore/ops/narrow.py
test/infinicore/ops/narrow.py
+1
-2
test/infinicore/ops/narrow_copy.py
test/infinicore/ops/narrow_copy.py
+7
-3
test/infinicore/ops/nll_loss.py
test/infinicore/ops/nll_loss.py
+1
-2
test/infinicore/ops/nonzero.py
test/infinicore/ops/nonzero.py
+1
-2
test/infinicore/ops/normalize.py
test/infinicore/ops/normalize.py
+1
-2
No files found.
test/infinicore/ops/max_unpool2d.py
View file @
61a7dc0e
...
...
@@ -5,8 +5,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework
import
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
from
framework.tensor
import
TensorInitializer
# Test cases format:
...
...
@@ -28,40 +27,72 @@ _TEST_CASES_DATA = [
# ========== Basic cases ==========
# small sizes with different stride/padding and optional output_size
((
1
,
1
,
16
,
16
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
False
,
None
),
((
2
,
3
,
16
,
16
),
(
2
,
2
),
None
,
None
,
False
,
None
),
# default stride / padding
((
2
,
3
,
8
,
8
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
False
,
None
),
((
1
,
4
,
7
,
9
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
False
,
None
),
((
4
,
8
,
14
,
14
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
True
,
(
27
,
27
)),
# H,W: (14-1)*2 - 2 + 3 = 27
((
4
,
8
,
14
,
14
),
(
2
,
2
),
None
,
(
1
,
1
),
True
,
(
26
,
26
)),
# H,W: (14-1)*2 - 2 + 2 = 26
((
2
,
16
,
10
,
12
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
True
,
(
20
,
24
)),
# H: (10-1)*2+2, W: (12-1)*2+2
((
2
,
16
,
10
,
12
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
True
,
(
19
,
23
)),
# H: (10-1)*2-2+3, W: (12-1)*2-2+3
((
2
,
3
,
16
,
16
),
(
2
,
2
),
None
,
None
,
False
,
None
),
# default stride / padding
((
2
,
3
,
8
,
8
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
False
,
None
),
((
1
,
4
,
7
,
9
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
False
,
None
),
(
(
4
,
8
,
14
,
14
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
True
,
(
27
,
27
),
),
# H,W: (14-1)*2 - 2 + 3 = 27
(
(
4
,
8
,
14
,
14
),
(
2
,
2
),
None
,
(
1
,
1
),
True
,
(
26
,
26
),
),
# H,W: (14-1)*2 - 2 + 2 = 26
(
(
2
,
16
,
10
,
12
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
True
,
(
20
,
24
),
),
# H: (10-1)*2+2, W: (12-1)*2+2
(
(
2
,
16
,
10
,
12
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
True
,
(
19
,
23
),
),
# H: (10-1)*2-2+3, W: (12-1)*2-2+3
# ========== Large-scale performance test cases ==========
# typical CNN activation map sizes and larger inputs
((
32
,
64
,
56
,
56
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
False
,
None
),
((
32
,
64
,
56
,
56
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
False
,
None
),
((
64
,
128
,
28
,
28
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
False
,
None
),
((
64
,
128
,
28
,
28
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
False
,
None
),
((
32
,
64
,
56
,
56
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
False
,
None
),
((
32
,
64
,
56
,
56
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
False
,
None
),
((
64
,
128
,
28
,
28
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
False
,
None
),
((
64
,
128
,
28
,
28
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
False
,
None
),
((
128
,
256
,
14
,
14
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
False
,
None
),
((
128
,
256
,
14
,
14
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
False
,
None
),
((
256
,
512
,
7
,
7
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
False
,
None
),
((
256
,
512
,
7
,
7
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
False
,
None
),
((
256
,
512
,
7
,
7
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
False
,
None
),
((
256
,
512
,
7
,
7
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
False
,
None
),
# large inputs with explicit output_size
((
16
,
32
,
64
,
64
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
True
,
(
128
,
128
)),
((
16
,
32
,
64
,
64
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
True
,
(
128
,
128
)),
# H,W: (64-1)*2 - 0 + 2 = 128
((
16
,
32
,
64
,
64
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
True
,
(
127
,
127
)),
((
16
,
32
,
64
,
64
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
True
,
(
127
,
127
)),
# H,W: (64-1)*2 - 2 + 3 = 127
((
8
,
64
,
32
,
48
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
True
,
(
64
,
96
)),
((
8
,
64
,
32
,
48
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
True
,
(
64
,
96
)),
# H: (32-1)*2+2=64, W: (48-1)*2+2=96
((
8
,
64
,
32
,
48
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
True
,
(
63
,
95
)),
((
8
,
64
,
32
,
48
),
(
3
,
3
),
(
2
,
2
),
(
1
,
1
),
True
,
(
63
,
95
)),
# H: (32-1)*2-2+3=63, W: (48-1)*2-2+3=95
# ========== Edge cases ==========
((
1
,
1
,
1
,
1
),
(
1
,
1
),
(
1
,
1
),
(
0
,
0
),
False
,
None
),
((
1
,
4
,
2
,
2
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
True
,
(
4
,
4
)),
# H,W: (2-1)*2+2=4
((
1
,
4
,
2
,
2
),
(
2
,
2
),
(
2
,
2
),
(
0
,
0
),
True
,
(
4
,
4
)),
# H,W: (2-1)*2+2=4
((
1
,
2
,
1
,
8
),
(
2
,
2
),
(
2
,
2
),
(
0
,
1
),
False
,
None
),
((
1
,
2
,
3
,
5
),
(
2
,
2
),
(
2
,
2
),
(
1
,
0
),
True
,
(
4
,
10
)),
# H: (3-1)*2-2+2, W: (5-1)*2+2
(
(
1
,
2
,
3
,
5
),
(
2
,
2
),
(
2
,
2
),
(
1
,
0
),
True
,
(
4
,
10
),
),
# H: (3-1)*2-2+2, W: (5-1)*2+2
]
_TOLERANCE_MAP
=
{
...
...
@@ -93,8 +124,14 @@ def parse_test_cases():
"""
test_cases
=
[]
for
(
input_shape
,
kernel_size
,
stride
,
padding
,
use_output_size
,
output_hw
)
in
_TEST_CASES_DATA
:
for
(
input_shape
,
kernel_size
,
stride
,
padding
,
use_output_size
,
output_hw
,
)
in
_TEST_CASES_DATA
:
indices_high
=
_kernel_elems_2d
(
kernel_size
)
...
...
test/infinicore/ops/max_unpool3d.py
View file @
61a7dc0e
...
...
@@ -5,8 +5,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework
import
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
from
framework.tensor
import
TensorInitializer
# ==============================================================================
...
...
@@ -32,33 +31,31 @@ _TEST_CASES_DATA = [
# ========== Basic cases ==========
# small sizes with different stride/padding and optional output_size
((
1
,
1
,
4
,
4
,
4
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
False
,
None
),
((
2
,
3
,
2
,
4
,
4
),
(
2
,
2
,
2
),
None
,
None
,
False
,
None
),
# default stride / padding
((
2
,
3
,
2
,
4
,
4
),
(
2
,
2
,
2
),
None
,
None
,
False
,
None
),
# default stride / padding
((
2
,
3
,
4
,
4
,
4
),
(
3
,
3
,
3
),
(
2
,
2
,
2
),
(
1
,
1
,
1
),
False
,
None
),
((
2
,
3
,
4
,
4
,
4
),
(
3
,
3
,
3
),
(
2
,
2
,
2
),
(
1
,
1
,
1
),
True
,
(
7
,
7
,
7
)),
((
2
,
3
,
4
,
4
,
4
),
(
3
,
3
,
3
),
(
2
,
2
,
2
),
(
1
,
1
,
1
),
True
,
(
7
,
7
,
7
)),
((
1
,
4
,
3
,
5
,
7
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
False
,
None
),
((
1
,
4
,
3
,
5
,
7
),
(
2
,
2
,
2
),
None
,
(
1
,
1
,
1
),
True
,
(
4
,
8
,
12
)),
((
1
,
4
,
3
,
5
,
7
),
(
2
,
2
,
2
),
None
,
(
1
,
1
,
1
),
True
,
(
4
,
8
,
12
)),
# ========== Large-scale performance test cases ==========
# larger volumes and batches for performance and stability
((
4
,
8
,
8
,
16
,
16
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
False
,
None
),
((
4
,
8
,
8
,
16
,
16
),
(
3
,
3
,
3
),
(
2
,
2
,
2
),
(
1
,
1
,
1
),
False
,
None
),
((
8
,
16
,
4
,
32
,
32
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
False
,
None
),
((
8
,
16
,
4
,
32
,
32
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
True
,
(
8
,
64
,
64
)),
((
8
,
16
,
4
,
32
,
32
),
(
3
,
3
,
3
),
(
2
,
2
,
2
),
(
1
,
1
,
1
),
True
,
(
7
,
63
,
63
)),
((
4
,
8
,
8
,
16
,
16
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
False
,
None
),
((
4
,
8
,
8
,
16
,
16
),
(
3
,
3
,
3
),
(
2
,
2
,
2
),
(
1
,
1
,
1
),
False
,
None
),
((
8
,
16
,
4
,
32
,
32
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
False
,
None
),
((
8
,
16
,
4
,
32
,
32
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
True
,
(
8
,
64
,
64
)),
((
8
,
16
,
4
,
32
,
32
),
(
3
,
3
,
3
),
(
2
,
2
,
2
),
(
1
,
1
,
1
),
True
,
(
7
,
63
,
63
)),
((
2
,
32
,
16
,
16
,
16
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
False
,
None
),
((
2
,
32
,
16
,
16
,
16
),
(
2
,
2
,
2
),
None
,
None
,
False
,
None
),
((
2
,
32
,
8
,
32
,
32
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
False
,
None
),
((
2
,
32
,
8
,
32
,
32
),
(
3
,
3
,
3
),
(
2
,
2
,
2
),
(
1
,
1
,
1
),
False
,
None
),
((
1
,
64
,
8
,
64
,
64
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
False
,
None
),
((
1
,
64
,
8
,
64
,
64
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
True
,
(
16
,
128
,
128
)),
((
2
,
32
,
16
,
16
,
16
),
(
2
,
2
,
2
),
None
,
None
,
False
,
None
),
((
2
,
32
,
8
,
32
,
32
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
False
,
None
),
((
2
,
32
,
8
,
32
,
32
),
(
3
,
3
,
3
),
(
2
,
2
,
2
),
(
1
,
1
,
1
),
False
,
None
),
((
1
,
64
,
8
,
64
,
64
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
False
,
None
),
((
1
,
64
,
8
,
64
,
64
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
True
,
(
16
,
128
,
128
)),
((
1
,
64
,
4
,
64
,
128
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
False
,
None
),
# ========== Edge cases ==========
# very small shapes and asymmetric sizes
((
1
,
1
,
1
,
1
,
1
),
(
1
,
1
,
1
),
(
1
,
1
,
1
),
(
0
,
0
,
0
),
False
,
None
),
((
1
,
1
,
1
,
2
,
2
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
True
,
(
2
,
4
,
4
)),
((
1
,
1
,
1
,
2
,
2
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
True
,
(
2
,
4
,
4
)),
((
1
,
1
,
2
,
2
,
8
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
0
,
0
,
0
),
False
,
None
),
((
1
,
1
,
2
,
2
,
8
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
1
,
1
,
1
),
True
,
(
2
,
2
,
14
)),
((
1
,
1
,
2
,
2
,
8
),
(
2
,
2
,
2
),
(
2
,
2
,
2
),
(
1
,
1
,
1
),
True
,
(
2
,
2
,
14
)),
]
_TOLERANCE_MAP
=
{
...
...
@@ -90,8 +87,14 @@ def parse_test_cases():
"""
test_cases
=
[]
for
(
input_shape
,
kernel_size
,
stride
,
padding
,
use_output_size
,
output_dhw
)
in
_TEST_CASES_DATA
:
for
(
input_shape
,
kernel_size
,
stride
,
padding
,
use_output_size
,
output_dhw
,
)
in
_TEST_CASES_DATA
:
indices_high
=
_kernel_elems_3d
(
kernel_size
)
...
...
test/infinicore/ops/maximum.py
View file @
61a7dc0e
...
...
@@ -5,9 +5,13 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework.utils
import
is_broadcast
from
framework
import
(
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
,
is_broadcast
,
)
# Test cases format: (shape, a_strides, b_strides)
_TEST_CASES_DATA
=
[
...
...
test/infinicore/ops/mean.py
View file @
61a7dc0e
...
...
@@ -5,9 +5,13 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework.utils
import
is_broadcast
from
framework
import
(
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
,
is_broadcast
,
)
# Test cases format: (in_shape, in_strides_or_None, dim_or_None, keepdim_or_None, out_strides_or_None)
# mean computes average along dimension(s) or overall
...
...
test/infinicore/ops/median.py
View file @
61a7dc0e
...
...
@@ -5,9 +5,13 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework.utils
import
is_broadcast
from
framework
import
(
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
,
is_broadcast
,
)
# Test cases format: (in_shape, in_strides_or_None, dim_or_None, keepdim_or_None, out_strides_or_None)
# median can return median values (and indices when dim is provided)
...
...
test/infinicore/ops/min.py
View file @
61a7dc0e
...
...
@@ -5,9 +5,13 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework.utils
import
is_broadcast
from
framework
import
(
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
,
is_broadcast
,
)
# Test cases format: (in_shape, in_strides_or_None, dim_or_None, keepdim_or_None, out_strides_or_None)
# min reduces by taking minimum along dim(s) or overall
...
...
test/infinicore/ops/minimum.py
View file @
61a7dc0e
...
...
@@ -5,9 +5,13 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework.utils
import
is_broadcast
from
framework
import
(
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
,
is_broadcast
,
)
# Test cases format: (shape, a_strides, b_strides)
_TEST_CASES_DATA
=
[
...
...
test/infinicore/ops/mish.py
View file @
61a7dc0e
...
...
@@ -5,9 +5,13 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework.utils
import
is_broadcast
from
framework
import
(
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
,
is_broadcast
,
)
# Test cases format: (in_shape, in_strides_or_None)
...
...
test/infinicore/ops/mse_loss.py
View file @
61a7dc0e
...
...
@@ -5,8 +5,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework
import
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
# Test cases format: (input_shape, target_shape, input_strides_or_None, reduction_or_None)
# infinicore.nn.functional.mse_loss(input, target, reduction='mean')
...
...
test/infinicore/ops/msort.py
View file @
61a7dc0e
...
...
@@ -5,9 +5,13 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework.utils
import
is_broadcast
from
framework
import
(
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
,
is_broadcast
,
)
# Test cases format: (shape, input_strides)
_TEST_CASES_DATA
=
[
...
...
test/infinicore/ops/mul.py
View file @
61a7dc0e
...
...
@@ -5,9 +5,13 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework.utils
import
is_broadcast
from
framework
import
(
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
,
is_broadcast
,
)
# ==============================================================================
# Operator-specific configuration
...
...
test/infinicore/ops/multi_margin_loss.py
View file @
61a7dc0e
...
...
@@ -6,8 +6,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
torch.nn.functional
as
F
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework
import
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
from
framework.tensor
import
TensorInitializer
# ==============================================================================
...
...
test/infinicore/ops/multilabel_margin_loss.py
View file @
61a7dc0e
...
...
@@ -5,8 +5,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework
import
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
from
framework.tensor
import
TensorInitializer
# Test cases format: (input_shape_N_C, target_shape_N_C, input_strides_or_None, reduction_or_None)
...
...
test/infinicore/ops/multilabel_soft_margin_loss.py
View file @
61a7dc0e
...
...
@@ -5,8 +5,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework
import
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
# Test cases format: (input_shape, target_shape, input_strides_or_None, reduction_or_None)
# infinicore.nn.functional.multilabel_soft_margin_loss(input, target, reduction='mean')
...
...
test/infinicore/ops/mv.py
View file @
61a7dc0e
...
...
@@ -5,9 +5,13 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework.utils
import
is_broadcast
from
framework
import
(
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
,
is_broadcast
,
)
# Test cases format: (mat_shape, vec_shape, mat_strides_or_None, vec_strides_or_None)
# mv(mat, vec, out=None)
...
...
test/infinicore/ops/narrow.py
View file @
61a7dc0e
...
...
@@ -5,8 +5,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework
import
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
# Test cases format: (input_shape, input_strides_or_None, dim, start, length)
_TEST_CASES_DATA
=
[
...
...
test/infinicore/ops/narrow_copy.py
View file @
61a7dc0e
...
...
@@ -5,9 +5,13 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework.utils
import
is_broadcast
from
framework
import
(
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
,
is_broadcast
,
)
# Test cases format: (input_shape, input_strides_or_None, dim, start, length)
_TEST_CASES_DATA
=
[
...
...
test/infinicore/ops/nll_loss.py
View file @
61a7dc0e
...
...
@@ -5,8 +5,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework
import
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
from
framework.tensor
import
TensorInitializer
# Test cases format: (input_shape_N_C, target_shape_N, input_strides_or_None, weight_present_bool, ignore_index_or_None)
...
...
test/infinicore/ops/nonzero.py
View file @
61a7dc0e
...
...
@@ -5,8 +5,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework
import
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
# Test cases format: (input_shape, input_strides_or_None)
# nonzero returns indices of non-zero elements; output is N x ndim indices
...
...
test/infinicore/ops/normalize.py
View file @
61a7dc0e
...
...
@@ -5,8 +5,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework.runner
import
GenericTestRunner
from
framework
import
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
# Test cases format: (input_shape, input_strides_or_None, p_or_None, dim_or_None, eps_or_None)
# infinicore.nn.functional.normalize(input, p=2.0, dim=1, eps=1e-12)
...
...
Prev
1
…
6
7
8
9
10
11
12
13
14
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment