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.

IDatasetV2.cs 2.5 kB

4 years ago
4 years ago
4 years ago
4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using System;
  2. using System.Collections.Generic;
  3. using Tensorflow.Framework.Models;
  4. namespace Tensorflow
  5. {
  6. public interface IDatasetV2 : IEnumerable<(Tensor, Tensor)>
  7. {
  8. Tensor variant_tensor { get; set; }
  9. TensorShape[] output_shapes { get; }
  10. TF_DataType[] output_types { get; }
  11. TensorSpec[] element_spec { get; }
  12. TensorSpec[] structure { get; set; }
  13. /// <summary>
  14. /// Caches the elements in this dataset.
  15. /// </summary>
  16. /// <param name="filename"></param>
  17. /// <returns></returns>
  18. IDatasetV2 cache(string filename = "");
  19. /// <summary>
  20. ///
  21. /// </summary>
  22. /// <param name="count"></param>
  23. /// <returns></returns>
  24. IDatasetV2 repeat(int count = -1);
  25. /// <summary>
  26. /// Creates a `Dataset` that includes only 1/`num_shards` of this dataset.
  27. /// </summary>
  28. /// <param name="num_shards">The number of shards operating in parallel</param>
  29. /// <param name="index">The worker index</param>
  30. /// <returns></returns>
  31. IDatasetV2 shard(int num_shards, int index);
  32. IDatasetV2 shuffle(int buffer_size, int? seed = null, bool reshuffle_each_iteration = true);
  33. /// <summary>
  34. /// Creates a `Dataset` that skips `count` elements from this dataset.
  35. /// </summary>
  36. /// <param name="count"></param>
  37. /// <returns></returns>
  38. IDatasetV2 skip(int count);
  39. IDatasetV2 batch(int batch_size, bool drop_remainder = false);
  40. IDatasetV2 prefetch(int buffer_size = -1, int? slack_period = null);
  41. IDatasetV2 take(int count);
  42. IDatasetV2 optimize(string[] optimizations, string[] optimization_configs);
  43. IDatasetV2 map(Func<Tensor, Tensor> map_func,
  44. bool use_inter_op_parallelism = true,
  45. bool preserve_cardinality = false,
  46. bool use_legacy_function = false);
  47. IDatasetV2 map(Func<Tensor, (Tensor, Tensor), (Tensor, Tensor)> map_func,
  48. int num_parallel_calls = -1);
  49. IDatasetV2 flat_map(Func<Tensor, IDatasetV2> map_func);
  50. IDatasetV2 model(AutotuneAlgorithm algorithm, long cpu_budget);
  51. IDatasetV2 with_options(DatasetOptions options);
  52. /// <summary>
  53. /// Apply options, such as optimization configuration, to the dataset.
  54. /// </summary>
  55. /// <returns></returns>
  56. IDatasetV2 apply_options();
  57. Tensor dataset_cardinality(string name = null);
  58. }
  59. }