a41f694cf0
Validate Operations / validate-operations (push) Waiting to run
add conv helpers new validation tests for matmul
Validation Operations
ONNX test models used by validate.py to verify the Raptor compiler + PIM simulator pipeline.
Generated tests can be regenerated with:
python3 validation/operations/gen_tests.py
Conv
| Test | Directory | Input | Output | Kernel | Stride | Padding | Bias | Notes |
|---|---|---|---|---|---|---|---|---|
| Simple | conv/simple |
[1,3,3,3] | [1,1,2,2] | 2x2 | 1 | none | no | Basic conv, hand-crafted |
| With constant | conv/with_constant |
[1,3,3,3] | [1,1,3,3] | 2x2 | 1 | SAME_UPPER | yes | Hand-crafted, constant weight+bias |
| Batch 2 | conv/batch_2 |
[2,3,3,3] | [2,1,3,3] | 2x2 | 1 | SAME_UPPER | yes | Batched input |
| Kernel 3x3 | conv/kernel_3x3 |
[1,1,5,5] | [1,1,3,3] | 3x3 | 1 | none | no | Larger kernel |
| Stride 2 | conv/stride_2 |
[1,1,6,6] | [1,1,2,2] | 3x3 | 2 | none | no | Strided convolution |
| Multi channel | conv/multi_channel |
[1,3,5,5] | [1,4,3,3] | 3x3 | 1 | none | no | 3 in channels, 4 out channels |
| Pointwise 1x1 | conv/pointwise_1x1 |
[1,8,4,4] | [1,4,4,4] | 1x1 | 1 | none | no | Channel mixing |
| SAME padding 3x3 | conv/same_padding_3x3 |
[1,1,5,5] | [1,1,5,5] | 3x3 | 1 | SAME_UPPER | no | Spatial dims preserved |
| Explicit padding | conv/explicit_padding |
[1,1,4,4] | [1,1,4,4] | 3x3 | 1 | [1,1,1,1] | no | Symmetric explicit pads |
| With bias 3x3 | conv/with_bias_3x3 |
[1,3,5,5] | [1,2,3,3] | 3x3 | 1 | none | yes | Multi-channel with bias |
| Large spatial | conv/large_spatial |
[1,1,8,8] | [1,1,6,6] | 3x3 | 1 | none | no | Larger spatial input |
| Grouped two groups | conv/grouped_two_groups |
[1,4,4,4] | [1,4,4,4] | 1x1 | 1 | none | yes | group=2 channel partitioning |
| Depthwise grouped | conv/depthwise_grouped |
[1,3,4,4] | [1,3,2,2] | 3x3 | 1 | none | no | group=3, one input channel per group |
| Dynamic | conv/dynamic |
[1,1,4,4] | [1,1,2,2] | 3x3 | 1 | none | no | Runtime input and weight |
Gemm
| Test | Directory | A (input) | B/W tensor | Output | transB | alpha | beta | Bias | Notes |
|---|---|---|---|---|---|---|---|---|---|
| Simple | gemm/simple |
[10,132] | [132,132] | [10,132] | no | 1 | 1 | no | Square weights |
| Non-square | gemm/non_square |
[4,128] | [128,64] | [4,64] | no | 1 | 1 | no | K != N |
| With bias | gemm/with_bias |
[4,128] | [128,128] | [4,128] | no | 1 | 1 | [128] | Bias vector |
| transB | gemm/transB |
[4,128] | [64,128] | [4,64] | yes | 1 | 1 | no | Transposed weight |
| Alpha/beta | gemm/alpha_beta |
[4,64] | [64,64] | [4,64] | no | 0.5 | 0.25 | [64] | Scaled matmul + bias |
| Small | gemm/small |
[2,8] | [8,4] | [2,4] | no | 1 | 1 | no | Tiny matrices |
| Large | gemm/large |
[8,256] | [256,128] | [8,128] | no | 1 | 1 | no | Larger matrices |
| transB + bias | gemm/transB_with_bias |
[4,128] | [64,128] | [4,64] | yes | 1 | 1 | [64] | Combined |
| Dynamic | gemm/dynamic |
[2,8] | [8,4] | [2,4] | no | 1 | 1 | no | Runtime matrix operands |
| Dynamic transB | gemm/dynamic_transB |
[2,8] | [4,8] | [2,4] | yes | 1 | 1 | no | Runtime transpose handling |
| Dynamic bias | gemm/dynamic_bias |
[2,8] | [8,4] | [2,4] | no | 1 | 1 | [4] | Runtime bias broadcast |
| Dynamic alpha | gemm/dynamic_alpha |
[2,8] | [8,4] | [2,4] | no | 0.5 | 1 | no | Runtime alpha scaling |
| Dynamic beta | gemm/dynamic_beta |
[2,8] | [8,4] | [2,4] | no | 1 | 2 | [4] | Runtime beta scaling |
| Dynamic bias + scale | gemm/dynamic_bias_alpha_beta |
[2,8] | [8,4] | [2,4] | no | 0.5 | 2 | [4] | Runtime operands and bias |
MatMul
| Test | Directory | A input | B tensor | Output | Notes |
|---|---|---|---|---|---|
| Basic | matmul/basic |
[2,3] | [3,4] | [2,4] | Direct 2D MatMul rewrite path |
| Left constant | matmul/left_constant |
[2,3] | [3,4] | [2,4] | Constant LHS transpose rewrite path |
| Dynamic | matmul/dynamic |
[2,3] | [3,4] | [2,4] | Runtime matrix operands |
| Batched 3D | matmul/batched_3d |
[2,2,3] | [2,3,4] | [2,2,4] | Matching-batch direct batched lowering |
| Batched 3D dynamic | matmul/batched_3d_dynamic |
[2,2,3] | [2,3,4] | [2,2,4] | Batched runtime operands |
| Batched left const | matmul/batched_left_constant |
[2,2,3] | [2,3,4] | [2,2,4] | Batched constant-LHS transpose path |
| Batched RHS broadcast | matmul/batched_rhs_broadcast |
[2,2,3] | [3,4] | [2,2,4] | Rank-2 RHS broadcast across batch |
| Batched LHS broadcast | matmul/batched_lhs_broadcast |
[2,3] | [2,3,4] | [2,2,4] | Rank-2 LHS broadcast across batched RHS |
Gemv
| Test | Directory | Input | W (weight) | Output | Bias | Notes |
|---|---|---|---|---|---|---|
| Simple | gemv/simple |
[1,132] | [132,132] | [1,132] | no | Single-sample matmul |
| Constant | gemv/constant |
(none) | [132,132] | [1,132] | no | All inputs constant |
| Homogeneous const | gemv/with_homogeneous_constant |
[1,132] | [132,132] | [1,132] | [1,132] | Bias matches output shape |
| Heterogeneous const | gemv/with_heterogeneous_constant |
[1,132] | [132,132] | [1,132] | [1,132] | Different constant pattern |
| Scalar const | gemv/with_scalar_constant |
[1,132] | [132,132] | [1,132] | [1,1] | Scalar bias, broadcast |
Pool
| Test | Directory | Input | Output | Kernel | Stride | Padding | Notes |
|---|---|---|---|---|---|---|---|
| Max basic | pool/max_basic |
[1,1,4,4] | [1,1,3,3] | 2x2 | 1 | none | Basic max pooling |
| Max stride 2 multi-channel | pool/max_stride2_multichannel |
[1,5,6,6] | [1,5,3,3] | 2x2 | 2 | none | Channel-preserving max pool |
| Max SAME_UPPER | pool/max_same_upper |
[1,1,5,5] | [1,1,3,3] | 3x3 | 2 | SAME_UPPER | Deprecated auto_pad path |
| Avg basic | pool/avg_basic |
[1,3,4,4] | [1,3,3,3] | 2x2 | 1 | none | Basic average pooling |
| Avg explicit padding | pool/avg_explicit_padding |
[1,2,4,4] | [1,2,2,2] | 3x3 | 2 | [1,1,1,1] | count_include_pad=0 |
| Avg include pad | pool/avg_include_pad |
[1,2,4,4] | [1,2,2,2] | 3x3 | 2 | [1,1,1,1] | count_include_pad=1 |
| Max after Conv | pool/max_after_conv |
[1,3,6,6] | [1,4,2,2] | Conv 3x3 then Pool 2x2 | 2 | none | Regression for pool(conv(...)) |
ReduceMean
| Test | Directory | Input | Output | Axes | Keepdims | Notes |
|---|---|---|---|---|---|---|
| Basic | reduce_mean/basic |
[4,8] | [4,1] | [1] | 1 | Reduce feature dimension, preserving rank |
| Keepdims 0 | reduce_mean/keepdims_0 |
[4,8] | [4] | [1] | 0 | Reduce feature dimension, dropping reduced axis |
| 4D spatial | reduce_mean/4d_spatial |
[1,3,4,4] | [1,3,1,1] | [2,3] | 1 | Reduce H and W on NCHW input |
| After Conv | reduce_mean/after_conv |
[1,3,5,5] | [1,2,1,1] | [2,3] | 1 | Conv 3x3 + bias, then spatial ReduceMean |
Relu
| Test | Directory | Input | Output | Notes |
|---|---|---|---|---|
| Basic | relu/basic |
[4,8] | [4,8] | Standalone 2D Relu |
| 4D | relu/4d |
[2,3,4,4] | [2,3,4,4] | Standalone NCHW Relu |
| After Conv | relu/after_conv |
[1,3,5,5] | [1,2,3,3] | Conv 3x3 + bias, then Relu |
| After Gemm | relu/after_gemm |
[4,64] | [4,32] | Gemm + bias, then Relu |
Sigmoid
| Test | Directory | Input | Output | Notes |
|---|---|---|---|---|
| Basic | sigmoid/basic |
[4,8] | [4,8] | Standalone 2D Sigmoid |
| 4D | sigmoid/4d |
[2,3,4,4] | [2,3,4,4] | Standalone NCHW Sigmoid |
| After Gemm | sigmoid/after_gemm |
[4,64] | [4,32] | Gemm + bias, then Sigmoid |
Softmax
| Test | Directory | Input | Output | Axis | Notes |
|---|---|---|---|---|---|
| Basic | softmax/basic |
[3,5] | [3,5] | 1 | Row-wise softmax over features |
| 3D last axis | softmax/3d_last_axis |
[2,3,4] | [2,3,4] | 2 | Last-dimension normalization |
| Channel axis | softmax/channel_axis |
[1,3,2,2] | [1,3,2,2] | 1 | NCHW channel-wise softmax |
Resize
| Test | Directory | Input | Output | Mode | Notes |
|---|---|---|---|---|---|
| Nearest 2x | resize/nearest_2x |
[1,1,2,3] | [1,1,4,6] | nearest | NCHW upsampling with scales [1,1,2,2] |
| Non-uniform scales | resize/non_uniform |
[1,1,2,3] | [1,1,6,6] | nearest | Different height/width scaling factors |
| Explicit sizes | resize/with_sizes |
[1,1,2,3] | [1,1,3,5] | nearest | Sizes input used instead of scales |
Split
| Test | Directory | Input | Outputs | Axis | Notes |
|---|---|---|---|---|---|
| Basic | split/basic |
[2,6] | [2,2], [2,4] | 1 | Two-way split with explicit sizes |
| Equal three-way | split/equal_three_way |
[2,6] | [2,2], [2,2], [2,2] | 1 | Optional split input omitted |
Gather
| Test | Directory | Input | Indices | Output | Axis | Notes |
|---|---|---|---|---|---|---|
| Axis 1 | gather/axis1 |
[3,4] | [2] | [3,2] | 1 | Select two columns |
| Axis 0 matrix indices | gather/axis0_matrix_indices |
[4,3] | [2,2] | [2,2,3] | 0 | Gather rows with 2D indices |
Concat
| Test | Directory | Input(s) | Output | Axis | Notes |
|---|---|---|---|---|---|
| Channel axis | concat/channel_axis |
A:[1,1,2,2], B:[1,2,2,2] | [1,3,2,2] | 1 | Runtime NCHW channel concat |
Reshape
| Test | Directory | Input | Output | Notes |
|---|---|---|---|---|
| Same rank | reshape/same_rank |
[2,3] | [3,2] | Runtime tensor with static shape initializer |
Add
| Test | Directory | Input(s) | Output | Notes |
|---|---|---|---|---|
| Basic | add/basic |
A:[4,8], B:[4,8] | [4,8] | Elementwise add, same-shape inputs |
| Broadcast row | add/broadcast_row |
A:[4,8], B:[8] | [4,8] | Row-vector broadcasting via initializer |
| After Gemm | add/after_gemm |
A:[4,64], D:[32] | [4,32] | Gemm + bias, then Add with broadcast vector |
Mul
| Test | Directory | Input(s) | Output | Notes |
|---|---|---|---|---|
| Basic | mul/basic |
A:[4,8], B:[4,8] | [4,8] | Elementwise multiply, same-shape inputs |
| Scalar constant | mul/scalar_constant |
X:[4,8], S:[1] | [4,8] | Scalar broadcasting via initializer |
| After Conv | mul/after_conv |
X:[1,3,5,5], S:[1,2,1,1] | [1,2,3,3] | Conv 3x3 + bias, then per-channel scaling |
Div
| Test | Directory | Input(s) | Output | Notes |
|---|---|---|---|---|
| Basic | div/basic |
X:[4,8], D:[4,8] | [4,8] | Elementwise divide by same-shape constant tensor |
| Scalar constant | div/scalar_constant |
X:[4,8], S:[1] | [4,8] | Scalar broadcasting via initializer |
| After Gemm | div/after_gemm |
A:[4,64], D:[32] | [4,32] | Gemm + bias, then Div with positive broadcast vector |