diff options
author | Chunseok Lee <chunseok.lee@samsung.com> | 2020-04-23 14:45:49 +0900 |
---|---|---|
committer | Chunseok Lee <chunseok.lee@samsung.com> | 2020-04-23 14:45:49 +0900 |
commit | e2ef8438a24f7c56a0744eb579a6e293ee2fbf8e (patch) | |
tree | 44a1a7951d168dd4370e13593ed03f4bc6d920c5 /tests/nnapi/specs/V1_2/reduce_sum_4D_float_reducing_C_nnfw.mod.py | |
parent | 302e6564a7a76109e1178207e44e45a58631c477 (diff) | |
download | nnfw-e2ef8438a24f7c56a0744eb579a6e293ee2fbf8e.tar.gz nnfw-e2ef8438a24f7c56a0744eb579a6e293ee2fbf8e.tar.bz2 nnfw-e2ef8438a24f7c56a0744eb579a6e293ee2fbf8e.zip |
Imported Upstream version 1.4.0upstream/1.4.0submit/tizen/20200423.054851
Diffstat (limited to 'tests/nnapi/specs/V1_2/reduce_sum_4D_float_reducing_C_nnfw.mod.py')
-rwxr-xr-x | tests/nnapi/specs/V1_2/reduce_sum_4D_float_reducing_C_nnfw.mod.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/nnapi/specs/V1_2/reduce_sum_4D_float_reducing_C_nnfw.mod.py b/tests/nnapi/specs/V1_2/reduce_sum_4D_float_reducing_C_nnfw.mod.py new file mode 100755 index 000000000..2ae69a90c --- /dev/null +++ b/tests/nnapi/specs/V1_2/reduce_sum_4D_float_reducing_C_nnfw.mod.py @@ -0,0 +1,33 @@ +batch = 2 +rows = 3 +cols = 4 +depth = 5 + +input_table = [x for x in range(batch * rows * cols * depth)] + +output_table = [0 for x in range(batch * rows * cols)] +for i in range(batch): + for j in range(rows): + for k in range(cols): + for l in range(depth): + # The value of output_table is the depthwise sum of input_table. + output_table[i * rows * cols + j * cols + k] += input_table[i * rows * cols * depth + j * cols * depth + k * depth + l]; + +model = Model() +i1 = Input("input", "TENSOR_FLOAT32", "{%d, %d, %d, %d}" % (batch, rows, cols, depth)) +# Axis value should be in the range [-(rank), rank). And '-n' is the same axis with 'rank - n'. So '3' and '-1' are the same axis. +axis = Parameter("axis", "TENSOR_INT32", "{2}", [3, -1]) +keepDims = False +output = Output("output", "TENSOR_FLOAT32", "{%d, %d, %d}" % (batch, rows, cols)) + +model = model.Operation("REDUCE_SUM", i1, axis, keepDims).To(output) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + input_table} + +output0 = {output: # output 0 + output_table} + +# Instantiate an example +Example((input0, output0)) |