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 3.2 kB

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