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.

IVariableV1.cs 2.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*****************************************************************************
  2. Copyright 2020 The TensorFlow.NET Authors. All Rights Reserved.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ******************************************************************************/
  13. using System;
  14. using System.Collections.Generic;
  15. namespace Tensorflow
  16. {
  17. /// <summary>
  18. /// A variable maintains state in the graph across calls to `run()`. You add a
  19. /// variable to the graph by constructing an instance of the class `Variable`.
  20. ///
  21. /// The `Variable()` constructor requires an initial value for the variable,
  22. /// which can be a `Tensor` of any type and shape. The initial value defines the
  23. /// type and shape of the variable. After construction, the type and shape of
  24. /// the variable are fixed. The value can be changed using one of the assign methods.
  25. /// https://tensorflow.org/guide/variables
  26. /// </summary>
  27. public interface IVariableV1
  28. {
  29. public string UniqueId { get; }
  30. public string Name { get; }
  31. /// <summary>
  32. /// Handle is ref type
  33. /// </summary>
  34. public Tensor Handle { get; }
  35. public string Device { get; }
  36. public Operation Initializer { get; }
  37. public Operation Op { get; }
  38. /// <summary>
  39. /// GraphElement is a copy of Handle
  40. /// </summary>
  41. public Tensor GraphElement { get; }
  42. public Graph Graph { get; }
  43. public TF_DataType dtype { get; }
  44. public TensorShape shape { get; }
  45. Tensor assign_add<T>(T delta, bool use_locking = false, string name = null, bool read_value = true);
  46. Tensor assign<T>(T value, bool use_locking = false, string name = null, bool read_value = true);
  47. Tensor AsTensor();
  48. }
  49. }