未验证 提交 cbc4d1bb 编写于 作者: Z ZaKiiiiiiiii 提交者: GitHub

Merge pull request #932 from Crayon-new:tf_pooling

add test case for "tf/reduce_sum"

* fix output dimension of reduce_sum

* add test case and fix bug

* add more cases

* style:change files name

* fix a little bug
上级 db894329
......@@ -594,6 +594,19 @@ save(inp, reduced, 'reduce_sum')
inp = tf.placeholder(tf.float32, [2, 3, 4, 5], 'input')
reduced = tf.reduce_sum(inp, axis=[2], keepdims=False)
save(inp, reduced, 'sum_pool_by_axis')
###############################################################################
#This test case generated by tensorflow 1.15.0
axises = [[0], [1], [2], [3], [1, 2]]
for axis in axises:
for keepdims in [False, True]:
inp = tf.placeholder(tf.float32, [2, 3, 4, 1])
biasadd = tf.nn.bias_add(inp, [1], data_format='NHWC')
print(axis, keepdims)
reduced = tf.reduce_sum(biasadd, axis=axis, keepdims=keepdims)
if len(axis) == 1:
save(inp, reduced + 1, f'reduce_sum_{axis[0]}_{keepdims}')
else:
save(inp, reduced + 1, f'reduce_sum_{axis[0]}_{axis[1]}_{keepdims}')
################################################################################
inp = tf.placeholder(tf.float32, [1, 4, 2, 3], 'input')
out = tf.math.reduce_sum(inp, axis=-1)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册