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.

VariableTest.cs 752 B

1234567891011121314151617181920212223242526
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System.Linq;
  3. using Tensorflow;
  4. using static Tensorflow.Binding;
  5. namespace TensorFlowNET.UnitTest.Basics
  6. {
  7. [TestClass]
  8. public class VariableTest : GraphModeTestBase
  9. {
  10. [TestMethod]
  11. public void InitVariable()
  12. {
  13. var v = tf.Variable(new[] { 1, 2 });
  14. var init = tf.compat.v1.global_variables_initializer();
  15. var sess = tf.compat.v1.Session();
  16. sess.run(init);
  17. // Usage passing the session explicitly.
  18. print(v.eval(sess));
  19. // Usage with the default session. The 'with' block
  20. // above makes 'sess' the default session.
  21. print(v.eval());
  22. }
  23. }
  24. }