Class: TensorFlow::Data::TensorSliceDataset

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

Instance Attribute Summary

Attributes inherited from Dataset

#output_shapes, #output_types

Instance Method Summary collapse

Methods inherited from Dataset

#batch, #each, from_tensor_slices, #shuffle, #to_ptr

Constructor Details

#initialize(element) ⇒ TensorSliceDataset

Returns a new instance of TensorSliceDataset.



4
5
6
7
8
9
10
11
12
# File 'lib/tensorflow/data/tensor_slice_dataset.rb', line 4

def initialize(element)
  tensors = Utils.to_tensor_array(element)
  @tensors = tensors # keep reference for memory
  @output_types = tensors.map(&:dtype)
  @output_shapes = tensors.map { |t| t.shape[1..-1] }

  variant_tensor = RawOps.tensor_slice_dataset(components: tensors, output_shapes: @output_shapes)
  super(variant_tensor)
end