DeepLearning - Maple Programming Help

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

DeepLearning

 IdentityMatrix
 create a constant Tensor

 Calling Sequence IdentityMatrix(m,opts) IdentityMatrix(m,n,opts)

Parameters

 m - non-negative integer; number of rows n - non-negative integer; number of columns opts - zero or more options as specified below

Options

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

Details

 • The implementation of EinsteinSummation uses the tf.eye command from the TensorFlow Python API. Consult the TensorFlow Python API documentation for tf.eye for more information.

Examples

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

Add an IdentityMatrix tensor and check its shape.

 > $\mathrm{id}≔\mathrm{IdentityMatrix}\left(4,3,\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${\mathrm{id}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: eye/set_diag:0}}\\ {\mathrm{Shape: \left[4, 3\right]}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (1)
 > $\mathrm{Shape}\left(\mathrm{id}\right)$
 $\left[{4}{,}{3}\right]$ (2)

Compatibility

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