forked from SciSharp/TensorFlow.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrefetchDataset.cs
More file actions
29 lines (26 loc) · 888 Bytes
/
PrefetchDataset.cs
File metadata and controls
29 lines (26 loc) · 888 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
29
using System;
using System.Collections.Generic;
using System.Text;
using static Tensorflow.Binding;
namespace Tensorflow
{
/// <summary>
/// Creates a `Dataset` that prefetches elements from this dataset.
/// </summary>
public class PrefetchDataset : UnaryUnchangedStructureDataset
{
Tensor _buffer_size;
public PrefetchDataset(IDatasetV2 input_dataset,
long buffer_size = -1,
int? slack_period = null) :
base(input_dataset)
{
_buffer_size = tf.convert_to_tensor(buffer_size, dtype: TF_DataType.TF_INT64, name: "buffer_size");
variant_tensor = ops.prefetch_dataset(input_dataset.variant_tensor,
_buffer_size,
input_dataset.output_types,
input_dataset.output_shapes,
slack_period: slack_period);
}
}
}