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.

RandomDataset.cs 771 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using Tensorflow.NumPy;
  8. namespace Tensorflow.Keras.UnitTest.Helpers
  9. {
  10. public class RandomDataSet : DataSetBase
  11. {
  12. private Shape _shape;
  13. public RandomDataSet(Shape shape, int count)
  14. {
  15. _shape = shape;
  16. Debug.Assert(_shape.ndim == 3);
  17. long[] dims = new long[4];
  18. dims[0] = count;
  19. for (int i = 1; i < 4; i++)
  20. {
  21. dims[i] = _shape[i - 1];
  22. }
  23. Shape s = new Shape(dims);
  24. Data = np.random.normal(0, 2, s);
  25. Labels = np.random.uniform(0, 1, (count, 1));
  26. }
  27. }
  28. }