 DeepLearning/Tensor/Cast - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

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

DeepLearning/Tensor/Cast

cast Tensor to new type

 Calling Sequence Cast(x, t)

Parameters

 x - Tensor t - one of string,truefalse,integer,integer,float,float,complex, or complex

Description

 • The Cast(x,t) command constructs a Tensor by casting x to the specified type t.

Examples

 > $\mathrm{with}\left(\mathrm{DeepLearning}\right):$
 > $\mathrm{t1}≔\mathrm{Constant}\left(\left[\left[86,-15,77\right],\left[-19,-89,-80\right],\left[-53,66,-19\right]\right],\mathrm{datatype}=\mathrm{float}\left[4\right]\right)$
 ${\mathrm{t1}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: Const:0}}\\ {\mathrm{Shape: \left[3, 3\right]}}\\ {\mathrm{Data Type: float\left[4\right]}}\end{array}\right]$ (1)
 > $\mathrm{t2}≔\mathrm{Cast}\left(\mathrm{t1},\mathrm{complex}\left[8\right]\right)$
 ${\mathrm{t2}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: Cast:0}}\\ {\mathrm{Shape: \left[3, 3\right]}}\\ {\mathrm{Data Type: complex\left[8\right]}}\end{array}\right]$ (2)
 > $\mathrm{value}\left(\mathrm{t2}\right)$
 $\left[\begin{array}{ccc}{86.}{+}{0.}{}{I}& {-15.}{+}{0.}{}{I}& {77.}{+}{0.}{}{I}\\ {-19.}{+}{0.}{}{I}& {-89.}{+}{0.}{}{I}& {-80.}{+}{0.}{}{I}\\ {-53.}{+}{0.}{}{I}& {66.}{+}{0.}{}{I}& {-19.}{+}{0.}{}{I}\end{array}\right]$ (3)

Compatibility

 • The DeepLearning/Tensor/Cast command was introduced in Maple 2018.
 • For more information on Maple 2018 changes, see Updates in Maple 2018.

 See Also