Enter - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


DeepLearning[GradientTape]

  

Enter

  

enter a GradientTape context

  

Exit

  

exit a GradientTape context

 

Calling Sequence

Parameters

Description

Details

Examples

Compatibility

Calling Sequence

Enter( gt )

Exit( gt )

Parameters

gt

-

a GradientTape object

Description

• 

Enter(gt) enters the context of the GradientTape gt. All operations on watched Tensors or Variables from this point onwards will be recorded in gt for the purposes of computing derivatives.

• 

Exit(gt) exits the context of the GradientTape gt. Recording of operations on watched Tensors or Variables ceases.

  

Note: It is very important to remember to invoke Exit(gt) even when an error has occurred. A useful pattern is to invoke Enter within an try clause and include Exit in the associated finally clause to ensure it is always executed.

Details

• 

The implementations of Enter and Exit use the similarly named methods from tf.GradientTape in the TensorFlow Python API. Consult the TensorFlow Python API documentation for tf.GradientTape for more information.

Examples

Create a GradientTape object, enter its context and compute gradients

withDeepLearning:

tapeGradientTape

tapeDeepLearning GradientTape<tensorflow.python.eager.backprop.GradientTape object at 0x7f976ee682e0>

(1)

Entertape

DeepLearning GradientTape<tensorflow.python.eager.backprop.GradientTape object at 0x7f976ee682e0>

(2)

xConstant1.0&comma;2.0

xDeepLearning TensorShape: [2]Data Type: float[4]

(3)

tape:-Watchx

yx2

yDeepLearning TensorShape: [2]Data Type: float[4]

(4)

Jtape:-Jacobiany&comma;x

JDeepLearning TensorShape: [2, 2]Data Type: float[4]

(5)

Exittape

convertJ&comma;Matrix

2.0.0.4.

(6)

Compatibility

• 

The DeepLearning[GradientTape][Enter] and DeepLearning[GradientTape][Exit] commands were introduced in Maple 2022.

• 

For more information on Maple 2022 changes, see Updates in Maple 2022.

See Also

DeepLearning Overview

GradientTape