Sum of the values in a tensor, alongside the specified axis. Arguments: x: A tensor or variable. axis: An integer, the axis to sum over. keepdims: A boolean, whether to keep the dimensions or not. If `keepdims` is `False`, the rank of the tensor is reduced by
(x, axis=None, keepdims=False)
| 1881 | |
| 1882 | @keras_export('keras.backend.sum') |
| 1883 | def sum(x, axis=None, keepdims=False): |
| 1884 | """Sum of the values in a tensor, alongside the specified axis. |
| 1885 | |
| 1886 | Arguments: |
| 1887 | x: A tensor or variable. |
| 1888 | axis: An integer, the axis to sum over. |
| 1889 | keepdims: A boolean, whether to keep the dimensions or not. |
| 1890 | If `keepdims` is `False`, the rank of the tensor is reduced |
| 1891 | by 1. If `keepdims` is `True`, |
| 1892 | the reduced dimension is retained with length 1. |
| 1893 | |
| 1894 | Returns: |
| 1895 | A tensor with sum of `x`. |
| 1896 | """ |
| 1897 | return math_ops.reduce_sum(x, axis, keepdims) |
| 1898 | |
| 1899 | |
| 1900 | @keras_export('keras.backend.prod') |