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.

ResourceVariable.Implicit.cs 1.2 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using Tensorflow.Eager;
  3. using static Tensorflow.Binding;
  4. namespace Tensorflow
  5. {
  6. public partial class ResourceVariable
  7. {
  8. public static implicit operator _VariableScopeStore(ResourceVariable variable)
  9. {
  10. return null;
  11. }
  12. public static implicit operator ResourceVariable(_VariableScopeStore store)
  13. {
  14. return null;
  15. }
  16. public static implicit operator Tensor(ResourceVariable var)
  17. => var._dense_var_to_tensor();
  18. public static implicit operator EagerTensor(ResourceVariable var)
  19. => var._dense_var_to_tensor() as EagerTensor;
  20. public static implicit operator IntPtr(ResourceVariable var)
  21. => var._handle;
  22. Tensor _dense_var_to_tensor(TF_DataType dtype = TF_DataType.DtInvalid,
  23. string name = null,
  24. bool as_ref = false)
  25. {
  26. return value();
  27. }
  28. public Tensor _TensorConversionFunction(TF_DataType dtype = TF_DataType.DtInvalid, string name = null, bool as_ref = false)
  29. {
  30. if (as_ref)
  31. return handle;
  32. else
  33. return AsTensor();
  34. }
  35. }
  36. }