forked from SciSharp/TensorFlow.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRangeDataset.cs
More file actions
28 lines (25 loc) · 846 Bytes
/
RangeDataset.cs
File metadata and controls
28 lines (25 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Collections.Generic;
using System.Text;
using Tensorflow.Framework.Models;
using static Tensorflow.Binding;
namespace Tensorflow.Data
{
public class RangeDataset : DatasetSource
{
Tensor start;
Tensor step;
Tensor stop;
public RangeDataset(int stop,
int start = 0,
int step = 1,
TF_DataType output_type = TF_DataType.TF_INT64)
{
this.start = tf.convert_to_tensor((long)start);
this.step = tf.convert_to_tensor((long)step);
this.stop = tf.convert_to_tensor((long)stop);
structure = new TensorSpec[] { new TensorSpec(new int[0], dtype: output_type) };
variant_tensor = ops.range_dataset(this.start, this.stop, this.step, output_types, output_shapes);
}
}
}