Skip to content

Commit e3e045a

Browse files
authored
Merge pull request #1194 from Abdurrahheem:ash/reduce-parser-fix
Reduce Cosnts Inputs tests.
2 parents 315dfee + 40357c9 commit e3e045a

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed
140 Bytes
Binary file not shown.
248 Bytes
Binary file not shown.

testdata/dnn/onnx/generate_onnx_models_with_onnxscript.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,3 +380,20 @@ def clip_div_shared_constant(x: ost.FLOAT[1, 8, 12, 10]) -> ost.FLOAT[1, 8, 12,
380380
clip = op.Clip(div, Constant_output_0, Constant_1_output_0)
381381
return clip
382382
make_model_and_data(clip_div_shared_constant, np.random.rand(1, 8, 12, 10).astype(np.float32))
383+
384+
batch_size = 3
385+
dim_size = 10
386+
@ost.script()
387+
def reducesum_consts(x: ost.FLOAT[batch_size, 1]) -> ost.FLOAT[dim_size]:
388+
389+
# Constants
390+
base_value = op.Constant(value=onnx.helper.make_tensor("", onnx.TensorProto.FLOAT, [dim_size, batch_size], np.ones(batch_size * dim_size)))
391+
pow_y = op.Constant(value=onnx.helper.make_tensor("", onnx.TensorProto.FLOAT, [], np.array([2.0])))
392+
393+
# Operations
394+
pow_result = op.Pow(base_value, pow_y)
395+
output = op.ReduceSum(pow_result, axes=[1], keepdims=0)
396+
397+
output = op.Add(output, x)
398+
return output
399+
make_model_and_data(reducesum_consts, np.zeros((batch_size, 1), dtype=np.float32))
634 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)