DeterministicRandomTestTool is a testing tool.
tf.compat.v1.keras.utils.DeterministicRandomTestTool( seed: int = 42, mode='constant' )
This tool is used to validate random number generation semantics match between TF1.x graphs/sessions and eager execution.
This is useful when you are migrating from TF 1.x to TF2 and need to make sure your computation is still happening correctly along the way. See the validating correctness migration guide for more info : https://www.tensorflow.org/guide/migrate/validate_correctness
The following DeterministicRandomTestTool object provides a context manager scope() that can make stateful random operations use the same seed across both TF1 graphs/sessions and eager execution,The tool provides two testing modes:
This applies both to the stateful random operations used for creating and initializing variables, and to the stateful random operations used in computation (such as for dropout layers).
Attributes | |
---|---|
operation_seed |
scope
scope()
set random seed.
© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/compat/v1/keras/utils/DeterministicRandomTestTool