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.

RangeDataset.cs 777 B

5 years ago
5 years ago
12345678910111213141516171819202122232425
  1. using Tensorflow.Framework.Models;
  2. using static Tensorflow.Binding;
  3. namespace Tensorflow.Data
  4. {
  5. public class RangeDataset : DatasetSource
  6. {
  7. Tensor start;
  8. Tensor step;
  9. Tensor stop;
  10. public RangeDataset(int stop,
  11. int start = 0,
  12. int step = 1,
  13. TF_DataType output_type = TF_DataType.TF_INT64)
  14. {
  15. this.start = tf.convert_to_tensor((long)start);
  16. this.step = tf.convert_to_tensor((long)step);
  17. this.stop = tf.convert_to_tensor((long)stop);
  18. structure = new TensorSpec[] { new TensorSpec(new int[0], dtype: output_type) };
  19. variant_tensor = ops.range_dataset(this.start, this.stop, this.step, output_types, output_shapes);
  20. }
  21. }
  22. }