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
123 additions
and
58 deletions
+123
-58
test/infinicore/ops/one_hot.py
test/infinicore/ops/one_hot.py
+1
-2
test/infinicore/ops/pad.py
test/infinicore/ops/pad.py
+7
-3
test/infinicore/ops/pairwise_distance.py
test/infinicore/ops/pairwise_distance.py
+7
-3
test/infinicore/ops/pdist.py
test/infinicore/ops/pdist.py
+7
-3
test/infinicore/ops/pixel_shuffle.py
test/infinicore/ops/pixel_shuffle.py
+7
-3
test/infinicore/ops/pixel_unshuffle.py
test/infinicore/ops/pixel_unshuffle.py
+7
-3
test/infinicore/ops/prelu.py
test/infinicore/ops/prelu.py
+7
-3
test/infinicore/ops/prod.py
test/infinicore/ops/prod.py
+7
-3
test/infinicore/ops/quantile.py
test/infinicore/ops/quantile.py
+7
-3
test/infinicore/ops/random_sample.py
test/infinicore/ops/random_sample.py
+1
-2
test/infinicore/ops/reciprocal.py
test/infinicore/ops/reciprocal.py
+7
-3
test/infinicore/ops/relu6.py
test/infinicore/ops/relu6.py
+7
-3
test/infinicore/ops/remainder.py
test/infinicore/ops/remainder.py
+7
-3
test/infinicore/ops/reshape.py
test/infinicore/ops/reshape.py
+7
-3
test/infinicore/ops/rms_norm.py
test/infinicore/ops/rms_norm.py
+8
-4
test/infinicore/ops/rope.py
test/infinicore/ops/rope.py
+7
-3
test/infinicore/ops/rot90.py
test/infinicore/ops/rot90.py
+7
-3
test/infinicore/ops/round.py
test/infinicore/ops/round.py
+7
-3
test/infinicore/ops/rrelu.py
test/infinicore/ops/rrelu.py
+7
-3
test/infinicore/ops/scaled_dot_product_attention.py
test/infinicore/ops/scaled_dot_product_attention.py
+1
-2
No files found.
test/infinicore/ops/one_hot.py
View file @
61a7dc0e
...
...
@@ -5,9 +5,8 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
from
framework
.base
import
BaseOperatorTest
,
TensorSpec
,
TestCase
from
framework
import
BaseOperatorTest
,
TensorSpec
,
TestCase
,
GenericTestRunner
from
framework.tensor
import
TensorInitializer
from
framework.runner
import
GenericTestRunner
# Test cases format: (indices_shape, indices_strides_or_None, num_classes_or_None)
_TEST_CASES_DATA
=
[
...
...
test/infinicore/ops/pad.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, pad_tuple, mode, value_or_None, input_strides_or_None)
# infinicore.nn.functional.pad(input, pad, mode='constant', value=0)
...
...
test/infinicore/ops/pairwise_distance.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, p, eps, keepdim, a_strides_or_None, b_strides_or_None)
# infinicore.nn.functional.pairwise_distance(x1, x2, p=2.0, eps=1e-6, keepdim=False)
...
...
test/infinicore/ops/pdist.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, p, a_strides_or_None)
# infinicore.pdist(input, p=2.0) computes pairwise distances between rows of input
...
...
test/infinicore/ops/pixel_shuffle.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, upscale_factor, input_strides_or_None)
# infinicore.nn.functional.pixel_shuffle(input, upscale_factor)
...
...
test/infinicore/ops/pixel_unshuffle.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, downscale_factor, input_strides_or_None)
# infinicore.nn.functional.pixel_unshuffle(input, downscale_factor)
...
...
test/infinicore/ops/prelu.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, weight_shape_or_None)
# Note: PReLU requires a weight parameter of shape (C,) or (1,), we create a per-channel weight when possible.
...
...
test/infinicore/ops/prod.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, dtype_or_None)
# prod computes product along dim(s) or overall
...
...
test/infinicore/ops/quantile.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, q_or_None, dim_or_None, keepdim_or_None, out_strides_or_None)
# quantile computes quantiles along dim or overall. q may be float or tensor
...
...
test/infinicore/ops/random_sample.py
View file @
61a7dc0e
...
...
@@ -6,8 +6,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
import
infinicore
import
infinicore.nn.functional
as
F
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/reciprocal.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)
# infinicore.reciprocal(input)
...
...
test/infinicore/ops/relu6.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/remainder.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: (a_shape, a_strides_or_None, b_shape_or_None)
# infinicore.remainder(a, b)
...
...
test/infinicore/ops/reshape.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, new_shape)
# reshape can change shape; out parameter is not used in infinicore.reshape API (returns view or tensor)
...
...
test/infinicore/ops/rms_norm.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
...
...
@@ -150,7 +154,7 @@ class OpTest(BaseOperatorTest):
def
infinicore_operator
(
self
,
x
,
weight
,
epsilon
=
_EPSILON
,
out
=
None
,
**
kwargs
):
"""InfiniCore RMSNorm implementation"""
import
infinicore.nn.functional
as
F
return
F
.
rms_norm
(
x
,
weight
.
shape
,
weight
,
epsilon
,
out
=
out
)
...
...
test/infinicore/ops/rope.py
View file @
61a7dc0e
...
...
@@ -5,9 +5,13 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import
torch
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
,
)
from
infinicore.nn.functional
import
RopeAlgo
import
infinicore
...
...
test/infinicore/ops/rot90.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, k, dims_tuple, input_strides_or_None)
# infinicore.rot90(input, k=1, dims=(0,1))
...
...
test/infinicore/ops/round.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
,
)
# round(input, decimals=0)
# We'll test with various decimals including negative values and None.
...
...
test/infinicore/ops/rrelu.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, lower_or_None, upper_or_None)
...
...
test/infinicore/ops/scaled_dot_product_attention.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: (q_shape, k_shape, v_shape, attn_mask_or_None, dropout_p, is_causal)
# q/k/v typically have shape (..., seq_len, head_dim) or (batch, seq_len, num_heads, head_dim)
...
...
Prev
1
…
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