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.

DatasetAdapter.cs 844 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Tensorflow.Keras.ArgsDefinition;
  5. namespace Tensorflow.Keras.Engine.DataAdapters
  6. {
  7. public class DatasetAdapter : IDataAdapter
  8. {
  9. DataAdapterArgs args;
  10. IDatasetV2 _dataset => args.Dataset;
  11. public DatasetAdapter(DataAdapterArgs args)
  12. {
  13. this.args = args;
  14. }
  15. public bool CanHandle(Tensor x, Tensor y = null)
  16. {
  17. throw new NotImplementedException();
  18. }
  19. public IDatasetV2 GetDataset()
  20. => _dataset;
  21. public int GetSize()
  22. => -1;
  23. public (Tensor, Tensor) Expand1d(Tensor x, Tensor y)
  24. {
  25. if (y.TensorShape.ndim == 1)
  26. y = array_ops.expand_dims(y, axis: -1);
  27. return (x, y);
  28. }
  29. }
  30. }