 Tensor - Maple Help

DeepLearning

 Tensor
 tensor object for DeepLearning computation Description

 • A Tensor is an object representing a multidimensional array of data. It is the core unit of computation in the DeepLearning package.
 • By performing mathematical or other operations with Tensors, you are implicitly creating additional Tensors and extending the computation graph.
 • All Tensors have a datatype and a shape. The datatype is always known. The shape may be either fully or partially specified when the Tensor is created.
 • When eager execution is disabled, a Tensor corresponds to a partially defined computation which, when executed in a Session, produces a concrete instance of multidimensional data. When eager execution is enabled (the default) every Tensor already corresponds to a concrete data instance. Properties of Tensors

 • The following commands query properties of a Tensor. Element-wise Operations on Tensors

 • The following functions operate element-wise on a Tensor. Matrix Operations with Tensors

 • The following functions operate on Tensors as matrices. Other Operations on Tensors Examples

Create a one-dimensional Variable Tensor

 > $\mathrm{with}\left(\mathrm{DeepLearning}\right):$
 > $V≔\mathrm{Variable}\left(\left[1.5,7.2,2.3\right],\mathrm{datatype}={\mathrm{float}}_{8}\right)$
 ${V}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Variable}}\\ {\mathrm{Name: Variable:0}}\\ {\mathrm{Shape: \left[3\right]}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (1)
 > $\mathrm{Shape}\left(V\right)$
 $\left[{3}\right]$ (2)

Create a Constant two-dimensional Tensor

 > $C≔\mathrm{Constant}\left(⟨⟨0.4,0.7⟩|⟨0.7,-0.3⟩⟩\right)$
 ${C}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Shape: \left[2, 2\right]}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (3)
 > $\mathrm{Shape}\left(C\right)$
 $\left[{2}{,}{2}\right]$ (4) Compatibility

 • The DeepLearning[Tensor] command was introduced in Maple 2018.