Class: Tensorflow::Data::TfRecordDataset

Inherits:
Dataset
  • Object
show all
Defined in:
lib/tensorflow/data/tf_record_dataset.rb

Constant Summary collapse

DEFAULT_BUFFER_SIZE =

256 MB

256 * 1_048_576

Constants inherited from Dataset

Dataset::DEFAULT_READER_BUFFER_SIZE_BYTES

Instance Attribute Summary

Attributes inherited from Dataset

#output_shapes, #output_types, #variant_tensor

Instance Method Summary collapse

Methods inherited from Dataset

#batch, #data, #each, from_tensor_slices, from_tensors, #make_initializable_iterator, #make_one_shot_iterator, #map_func, #repeat, #shuffle, #to_ptr, to_tensor_array, #with_options

Constructor Details

#initialize(filenames, compression_type = '', buffer_size = DEFAULT_BUFFER_SIZE) ⇒ TfRecordDataset

Returns a new instance of TfRecordDataset.



6
7
8
9
10
11
12
13
14
15
# File 'lib/tensorflow/data/tf_record_dataset.rb', line 6

def initialize(filenames, compression_type='', buffer_size=DEFAULT_BUFFER_SIZE)
  filenames = Array(filenames)
  @output_types = [:string]
  @output_shapes = [[]]

  buffer_size = Tensor.new(buffer_size, dtype: :int64) if buffer_size
  variant_tensor = RawOps.tf_record_dataset(filenames, compression_type, buffer_size)

  super(variant_tensor)
end