DeepLearning/Tensor/Assign - Maple Programming Help

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

DeepLearning/Tensor/Assign

assign a value to a Tensor

increment the value of a Tensor

DeepLearning/Tensor/AssignSubtract

decrement the value of a Tensor

Parameters

 t - Tensor v - Tensor

Description

 • The Assign(t,v) command assigns the Tensor value v to the mutable Tensor t.
 • The AssignAdd(t,v) and AssignSub(t,v) commands behave similarly but instead of simply replacing the previous value of t, they increment and decrement, respectively, the existing value of t by v.
 • If t is not a mutable Tensor, an error will be thrown.

Examples

 > $\mathrm{with}\left(\mathrm{DeepLearning}\right):$
 > $c≔\mathrm{Constant}\left(⟨⟨1.,2.⟩|⟨3.,4.⟩⟩\right)$
 ${c}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: Const:0}}\\ {\mathrm{Shape: \left[2, 2\right]}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (1)
 > $t≔\mathrm{Variable}\left(⟨⟨0.,0.⟩|⟨0.,0.⟩⟩\right)$
 ${t}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: Variable:0}}\\ {\mathrm{Shape: \left[2, 2\right]}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (2)
 > $\mathrm{value}\left(\mathrm{VariablesInitializer}\left(\right)\right)$
 ${\mathrm{Python}}{:-}{\mathrm{None}}$ (3)
 > $\mathrm{Assign}\left(t,c\right)$
 $\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: Assign:0}}\\ {\mathrm{Shape: \left[2, 2\right]}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (4)
 > $\mathrm{value}\left(t\right)$
 $\left[\begin{array}{cc}{0.}& {0.}\\ {0.}& {0.}\end{array}\right]$ (5)

Compatibility

 • The DeepLearning/Tensor/Assign, DeepLearning/Tensor/AssignAdd and DeepLearning/Tensor/AssignSubtract commands were introduced in Maple 2018.