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

DeepLearning

 Variable
 create a Tensor Variable

 Calling Sequence Variable(val, opts)

Parameters

 val - list, Matrix, Vector, Array, DataFrame, or DataSeries; initial values opts - (optional) zero or more options as specified below

Options

 • datatype = one of string, truefalse, integer[4], integer[8], float[4], float[8], complex[4], or complex[8]
 Specifies the type of data this Tensor will hold. By default, the datatype is inferred from the initial data val.
 • name = string
 Specifies an optional name for this Tensor to be displayed in output.
 • trainable = truefalse
 Specifies whether GradientTapes should watch this Variable automatically. The default is true.

Description

 • The Variable(val,opts) command creates a Tensor variable in the active dataflow graph with initial value given by val.
 • This function is part of the DeepLearning package, so it can be used in the short form Variable(..) only after executing the command with(DeepLearning). However, it can always be accessed through the long form of the command by using DeepLearning[Variable](..).

Examples

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

Compatibility

 • The DeepLearning[Variable] command was introduced in Maple 2018.
 • For more information on Maple 2018 changes, see Updates in Maple 2018.
 • The DeepLearning[Variable] command was updated in Maple 2022.
 • The trainable option was introduced in Maple 2022.
 • For more information on Maple 2022 changes, see Updates in Maple 2022.