DeepLearning,Tensor,Diagonal - Maple Programming Help

Home : Support : Online Help : Programming : DeepLearning Package : Tensors : Matrix Operations on Tensors : DeepLearning/Tensor/Diagonal

DeepLearning,Tensor,Diagonal

construct diagonal tensor

 Calling Sequence Diagonal(x,opts)

Parameters

 x - Tensor opts - zero of more options as specified below.

Options

 • 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 Diagonal(x,opts) command returns a diagonal Tensor with a given diagonal values.
 • Given a diagonal x, this operation returns a Tensor with the diagonal and everything else padded with zeros.

Examples

 > $\mathrm{with}\left(\mathrm{DeepLearning}\right):$
 > $V≔⟨-35.0,65.0,41.0⟩$
 ${V}{≔}\left[\begin{array}{c}{-35.0}\\ {65.0}\\ {41.0}\end{array}\right]$ (1)
 > $t≔\mathrm{Constant}\left(V\right)$
 ${t}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: Const:0}}\\ {\mathrm{Shape: \left[3\right]}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (2)
 > $\mathrm{value}\left(\mathrm{Diagonal}\left(t\right)\right)$
 $\left[\begin{array}{ccc}{-35.}& {0.}& {0.}\\ {0.}& {65.}& {0.}\\ {0.}& {0.}& {41.}\end{array}\right]$ (3)

Compatibility

 • The DeepLearning,Tensor,Diagonal command was introduced in Maple 2018.