Class: Tensorflow::Data::TensorDataset

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

Constant Summary

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(elements) ⇒ TensorDataset

Returns a new instance of TensorDataset.



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

def initialize(elements)
  @tensors = self.class.to_tensor_array(elements)
  @output_types = @tensors.map(&:dtype)
  @output_shapes = @tensors.map do |tensor|
    tensor.shape
  end

  variant_tensor = RawOps.tensor_dataset(@tensors,
                                         toutput_types: @output_types,
                                         output_shapes: @output_shapes)

  super(variant_tensor)
end