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.

MemoryFuncGraphTest.cs 853 B

123456789101112131415161718192021222324252627282930
  1. using Tensorflow.NumPy;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using Tensorflow.Functions;
  6. using static Tensorflow.Binding;
  7. namespace Tensorflow
  8. {
  9. class MemoryFuncGraphTest
  10. {
  11. public Action<int, int> ConcreteFunction
  12. => (epoch, iterate) =>
  13. {
  14. var func = new ConcreteFunction(Guid.NewGuid().ToString());
  15. func.Enter();
  16. var input = tf.placeholder(tf.float32);
  17. var output = permutation(input);
  18. func.ToGraph(input, output);
  19. func.Exit();
  20. };
  21. Tensor permutation(Tensor tensor)
  22. {
  23. Shape shape = (8, 64, 64, 3);
  24. var images = np.arange(shape.size).astype(np.float32).reshape(shape.dims);
  25. return tf.constant(images);
  26. }
  27. }
  28. }