 DeepLearning - Maple Programming Help

Home : Support : Online Help : Programming : DeepLearning Package : Managing Sessions : DeepLearning/Session

DeepLearning

 Session
 get a new computation session

 Calling Sequence Session()

Description

 • The Session() command returns a new Session object for the current DataflowGraph.
 • This function is part of the DeepLearning package, so it can be used in the short form Session(..) only after executing the command with(DeepLearning). However, it can always be accessed through the long form of the command by using DeepLearning[Session](..).

Note

 • To obtain the default computation session for the current DataFlowGraph rather than a new session, use GetDefaultSession.

Examples

Here we execute the same simple graph (which just multiplies two Tensors) in the default computation session and in a new session.

 > $\mathrm{with}\left(\mathrm{DeepLearning}\right):$
 > $a≔\mathrm{Variable}\left(\left[21.5,72.0\right],\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${a}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: Variable:0}}\\ {\mathrm{Shape: \left[2\right]}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (1)
 > $b≔\mathrm{Variable}\left(\left[32.5,86.0\right],\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${b}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: Variable_1:0}}\\ {\mathrm{Shape: \left[2\right]}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (2)
 > $c≔\mathrm{Variable}\left(\left[17.2,94.2\right],\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${c}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: Variable_2:0}}\\ {\mathrm{Shape: \left[2\right]}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (3)
 > $\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]$ (4)
 > $\mathrm{new_sess}≔\mathrm{Session}\left(\right)$
 ${\mathrm{new_sess}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Session}}\\ {\mathrm{}}\end{array}\right]$ (5)
 > $\mathrm{new_sess}:-\mathrm{Run}\left(\mathrm{init}\right)$
 ${\mathrm{Python}}{:-}{\mathrm{None}}$ (6)
 > $\mathrm{new_sess}:-\mathrm{Run}\left({a}^{2}+{b}^{2}+{c}^{2}\right)$
 $\left[\begin{array}{c}{1814.34000000000}\\ {21453.6400000000}\end{array}\right]$ (7)

Compatibility

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