 DeepLearning - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Programming : DeepLearning Package : Tensors : Managing Tensors : DeepLearning/Constant

DeepLearning

 Constant
 create a constant Tensor

 Calling Sequence Constant(c,opts)

Parameters

 c - real or complex constant, Matrix, Vector, or list opts - zero or more options as specified below

Options

 • datatype=one of string,truefalse,integer,integer,float,float,complex, or complex
 The value of option datatype specifies the type of data this Tensor will hold. By default, the datatype is inferred from the value c.
 • 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 Constant(c) command creates a Tensor in the active dataflow graph whose value is the constant value c.
 • This function is part of the DeepLearning package, so it can be used in the short form Constant(..) only after executing the command with(DeepLearning). However, it can always be accessed through the long form of the command by using DeepLearning[Constant](..).

Examples

 > $\mathrm{with}\left(\mathrm{DeepLearning}\right):$

Define a constant Tensor and evaluate it in the current session.

 > $\mathrm{t1}≔\mathrm{Constant}\left(2.0\right)$
 ${\mathrm{t1}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: Const:0}}\\ {\mathrm{Shape: \left[\right]}}\\ {\mathrm{Data Type: float\left[4\right]}}\end{array}\right]$ (1)
 > $\mathrm{value}\left(\mathrm{t1}\right)$
 ${2.}$ (2)

Define a constant Tensor and evaluate it in the current session.

 > $\mathrm{t2}≔\mathrm{Constant}\left(⟨⟨1+2I,3+4I⟩,⟨1-2I,5-7I⟩⟩\right)$
 ${\mathrm{t2}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: Const_1:0}}\\ {\mathrm{Shape: \left[4, 1\right]}}\\ {\mathrm{Data Type: complex\left[8\right]}}\end{array}\right]$ (3)
 > $\mathrm{value}\left(\mathrm{t2}\right)$
 $\left[\begin{array}{c}{1.}{+}{2.}{}{I}\\ {3.}{+}{4.}{}{I}\\ {1.}{-}{2.}{}{I}\\ {5.}{-}{7.}{}{I}\end{array}\right]$ (4)

Compatibility

 • The DeepLearning[Constant] command was introduced in Maple 2018.
 • For more information on Maple 2018 changes, see Updates in Maple 2018.

 See Also