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.

MnistDataSet.cs 853 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using NumSharp;
  5. using Tensorflow;
  6. namespace Tensorflow.Hub
  7. {
  8. public class MnistDataSet : DataSetBase
  9. {
  10. public int NumOfExamples { get; private set; }
  11. public int EpochsCompleted { get; private set; }
  12. public int IndexInEpoch { get; private set; }
  13. public MnistDataSet(NDArray images, NDArray labels, Type dataType, bool reshape)
  14. {
  15. EpochsCompleted = 0;
  16. IndexInEpoch = 0;
  17. NumOfExamples = images.shape[0];
  18. images = images.reshape(images.shape[0], images.shape[1] * images.shape[2]);
  19. images.astype(dataType);
  20. images = np.multiply(images, 1.0f / 255.0f);
  21. Data = images;
  22. labels.astype(dataType);
  23. Labels = labels;
  24. }
  25. }
  26. }