DeepLearning - Maple Programming Help

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

DeepLearning

 ApplyOperation
 apply an operation

 Calling Sequence ApplyOperation(oper,t1,...,tn,opts)

Parameters

 oper - string t1,...,tn - numeric or Tensor; inputs to be passed to oper opts - options to be passed to oper

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 ApplyOperation(oper,t1,...,tn,opts) command applies the operation oper to the arguments t1,...,tn with options opts
 • The arguments t1,...,tn may be complex numerics or Tensor objects.
 • The operation oper must be a valid, fully-qualified, function name in the TensorFlow Python API. For a list of functions, consult the TensorFlow Python API Documentation.
 • For convenience the abbreviated syntax "tf." is also supported.
 • This function is part of the DeepLearning package, so it can be used in the short form ApplyOperation(..) only after executing the command with(DeepLearning). However, it can always be accessed through the long form of the command by using DeepLearning[ApplyOperation](..).

Examples

 > $\mathrm{with}\left(\mathrm{DeepLearning}\right):$
 > $\mathrm{t1}≔\mathrm{Constant}\left(\left[1.,2.\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[2\right]}}\\ {\mathrm{Data Type: float\left[4\right]}}\end{array}\right]$ (1)
 > $\mathrm{t2}≔\mathrm{Constant}\left(\left[3.,4.\right],\mathrm{datatype}=\mathrm{float}\left[4\right]\right)$
 ${\mathrm{t2}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: Const_1:0}}\\ {\mathrm{Shape: \left[2\right]}}\\ {\mathrm{Data Type: float\left[4\right]}}\end{array}\right]$ (2)

Add two tensors using standard Maple operators.

 > $\mathrm{t3}≔\mathrm{t1}+\mathrm{t2}$
 ${\mathrm{t3}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: Add:0}}\\ {\mathrm{Shape: \left[2\right]}}\\ {\mathrm{Data Type: float\left[4\right]}}\end{array}\right]$ (3)

Now perform the same operation using ApplyOperation.

 > $\mathrm{t4}≔\mathrm{ApplyOperation}\left("tf.add",\mathrm{t1},\mathrm{t2}\right)$
 ${\mathrm{t4}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: Add_1:0}}\\ {\mathrm{Shape: \left[2\right]}}\\ {\mathrm{Data Type: float\left[4\right]}}\end{array}\right]$ (4)

Compatibility

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