VariablesInitializer - Maple Help

DeepLearning

 VariablesInitializer
 initialize variables

 Calling Sequence VariablesInitializer()

Description

 • VariablesInitializer() returns an Operation which can be run in a Session to initialize all the variables in the graph.
 • Note that this command requires that eager execution be turned off beforehand using the SetEagerExecution command.
 • This function is part of the DeepLearning package, so it can be used in the short form VariablesInitializer(..) only after executing the command with(DeepLearning). However, it can always be accessed through the long form of the command by using DeepLearning[VariablesInitializer](..).

Details

 • The implementation of VariablesInitializer uses the tf.global_variables_initializer command from the TensorFlow Python API. Consult the TensorFlow Python API documentation for tf.global_variables_initializer for more information on random number generation during TensorFlow computations.

Examples

 > $\mathrm{with}\left(\mathrm{DeepLearning}\right):$
 > $\mathrm{SetEagerExecution}\left(\mathrm{false}\right)$
 ${\mathrm{true}}$ (1)
 > $v≔\mathrm{Variable}\left(\left[0.3\right],\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${v}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: Variable:0}}\\ {\mathrm{Shape: undefined}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (2)
 > $\mathrm{init}≔\mathrm{VariablesInitializer}\left(\right)$
 ${\mathrm{init}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: init}}\\ {\mathrm{Shape: undefined}}\\ {\mathrm{Data Type: undefined}}\end{array}\right]$ (3)
 > $\mathrm{sess}≔\mathrm{GetDefaultSession}\left(\right)$
 ${\mathrm{sess}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Session}}\\ {\mathrm{}}\end{array}\right]$ (4)
 > $\mathrm{sess}:-\mathrm{Run}\left(\mathrm{init}\right)$
 ${\mathrm{Python}}{:-}{\mathrm{None}}$ (5)

Compatibility

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