Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of Operation on tf.reduce_sum tensorflow Dimension

Shulou Source: shulou.com Published: 2022-06-03 17:48:18 09月18日 Update

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.

Tags: Dimensions articles examples analysis original examples official data more good practical content commonly used articles versions knowledge references help related input Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology macOS Docker Shulou Information Huawei