ReduceSum - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

DeepLearning/Tensor/ReduceAll

compute logical And over entries of a Tensor

DeepLearning/Tensor/ReduceAny

compute logical Or over entries of a Tensor

DeepLearning/Tensor/ReduceJoin

compute logsumexp over entries of a Tensor

DeepLearning/Tensor/ReduceLogSumExp

concatenate strings over entries of a Tensor

DeepLearning/Tensor/ReduceMax

compute maximum over entries of a Tensor

DeepLearning/Tensor/ReduceMean

compute mean over entries of a Tensor

DeepLearning/Tensor/ReduceMin

compute minimum over entries of a Tensor

DeepLearning/Tensor/ReduceProduct

compute product over entries of a Tensor

DeepLearning/Tensor/ReduceSum

compute sum over entries of a Tensor

 Calling Sequence ReduceAll(t,opts) ReduceAny(t,opts) ReduceLogSumExp(t,opts) ReduceJoin(t,opts) ReduceMax(t,opts) ReduceMean(t,opts) ReduceMin(t,opts) ReduceProduct(t,opts) ReduceSum(t,opts)

Parameters

 t - Tensor opts - zero or more options as specified below

Options

 • axis=list(integer) or integer

The value of option axis is an integer or list of integers which describes which axis of the input Tensor to reduce across.

 • name=string

The value of option name specifies an optional name for this Tensor, to be displayed in output and when visualizing the dataflow graph.

Description

 • The ReduceAll(t,opts) command computes the logical And of elements across a Tensor.
 • The ReduceAny(t,opts) command computes the logical Or of elements across a Tensor.
 • The ReduceJoin(t,opts) command concatenates string elements across a Tensor.
 • The ReduceLogSumExp(t,opts) command computes the logical logsumexp of elements across a Tensor. (This operation first exponentiates each entry being computed, adds the results, then takes the logarithm of the sum.)
 • The ReduceMax(t,opts) command computes the maximum of elements across a Tensor.
 • The ReduceMean(t,opts) command computes the mean of elements across a Tensor.
 • The ReduceMin(t,opts) command computes the minimum of elements across a Tensor.
 • The ReduceProduct(t,opts) command computes the product of elements across a Tensor.
 • The ReduceSum(t,opts) command computes the sum of elements across a Tensor.

Examples

 > $\mathrm{with}\left(\mathrm{DeepLearning}\right):$
 > $W≔\mathrm{Constant}\left(\left[0.3,0.7\right],\mathrm{datatype}={\mathrm{float}}_{8}\right)$
 ${W}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Shape: \left[2\right]}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (1)
 > $b≔\mathrm{Constant}\left(\left[-0.3,0.2\right],\mathrm{datatype}={\mathrm{float}}_{8}\right)$
 ${b}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Shape: \left[2\right]}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (2)
 > $x≔\mathrm{Variable}\left(\left[0.2,0.4\right],\mathrm{datatype}={\mathrm{float}}_{8}\right)$
 ${x}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Variable}}\\ {\mathrm{Name: Variable:0}}\\ {\mathrm{Shape: \left[2\right]}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (3)
 > $\mathrm{linear_model}≔Wx+b$
 ${\mathrm{linear_model}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Shape: \left[2\right]}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (4)
 > $y≔\mathrm{Variable}\left(\left[1.0,0.0\right],\mathrm{datatype}={\mathrm{float}}_{8}\right)$
 ${y}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Variable}}\\ {\mathrm{Name: Variable:0}}\\ {\mathrm{Shape: \left[2\right]}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (5)
 > $\mathrm{loss}≔\mathrm{ReduceSum}\left({\left(\mathrm{linear_model}-y\right)}^{2}\right)$
 ${\mathrm{loss}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Shape: \left[\right]}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (6)

Compatibility

 • The DeepLearning/Tensor/ReduceAll, DeepLearning/Tensor/ReduceAny, DeepLearning/Tensor/ReduceJoin, DeepLearning/Tensor/ReduceLogSumExp, DeepLearning/Tensor/ReduceMax, DeepLearning/Tensor/ReduceMean, DeepLearning/Tensor/ReduceMin, DeepLearning/Tensor/ReduceProduct and DeepLearning/Tensor/ReduceSum commands were introduced in Maple 2018.
 • For more information on Maple 2018 changes, see Updates in Maple 2018.