You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

GradientTape.cs 1.0 kB

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using static Tensorflow.Binding;
  5. namespace Tensorflow.Gradients
  6. {
  7. /// <summary>
  8. /// Record operations for automatic differentiation.
  9. ///
  10. /// Operations are recorded if they are executed within this context manager and
  11. /// at least one of their inputs is being "watched".
  12. ///
  13. /// Trainable variables (created by `tf.Variable` or `tf.compat.v1.get_variable`,
  14. /// where `trainable=True` is default in both cases) are automatically watched.
  15. /// Tensors can be manually watched by invoking the `watch` method on this context
  16. /// manager.
  17. /// </summary>
  18. public class GradientTape
  19. {
  20. bool _persistent;
  21. bool _watch_accessed_variables;
  22. public GradientTape(bool persistent = false,
  23. bool watch_accessed_variables = true)
  24. {
  25. _persistent = persistent;
  26. _watch_accessed_variables = watch_accessed_variables;
  27. }
  28. }
  29. }