Example Analysis of Operation on tf.reduce_sum tensorflow Dimension
This article will explain in detail the example analysis of the operation on the tf.reduce_sum tensorflow dimension. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
There are many dimensional operations in tensorflow, and this example is illustrated by the commonly used tf.reduce_sum. Official api
Reduce_sum (input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)
Input_tensor: indicates input
Axis: indicates that the sum operation is performed in that dimension.
Keep_dims: indicates whether to retain the dimension of the original data. False means that the original data will be missing one dimension after execution.
Reduction_indices: for compatibility with older versions, it is no longer in use.
Official examples:
#'x'is [[1,1,1] # [1,1,1]] tf.reduce_sum (x) = > 6tf.reduce_sum (x, 0) = > [2,2,2] tf.reduce_sum (x, 1) = > [3,3] tf.reduce_sum (x, 1, keep_dims=True) = > [3], [3]] tf.reduce_sum (x, [0,1]) = > 6
Examples made by yourself:
.. Axis=1: [[5 7 9] [17 19 21]] 1 "4 2" 5 3 + 6 … . Axis=2: [[6 15] [24 33]] 1, 2, 3, 4, 5, 6... .. This is the end of the article on "sample Analysis of Operations on tf.reduce_sum tensorflow Dimensions". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.