class Tensorflow::Data::OneShotIterator
Public Class Methods
new(dataset)
click to toggle source
Calls superclass method
Tensorflow::Data::Iterator::new
# File lib/tensorflow/data/iterator.rb, line 21 def initialize(dataset) super(dataset.output_types, dataset.output_shapes) create_one_shot_iterator(dataset) end
Private Instance Methods
create_one_shot_iterator(dataset)
click to toggle source
# File lib/tensorflow/data/iterator.rb, line 28 def create_one_shot_iterator(dataset) function = make_dataset_function(dataset) ExecutionContext.current.add_function(function) @iterator = RawOps.one_shot_iterator(dataset_factory: function, output_types: self.output_types, output_shapes: self.output_shapes) end
make_dataset_function(dataset)
click to toggle source
# File lib/tensorflow/data/iterator.rb, line 34 def make_dataset_function(dataset) function = Graph::Graph.new.as_default do |func_graph| optimize = RawOps.optimize_dataset(dataset.variant_tensor, ['noop_elimination'], output_types: self.output_types, output_shapes: self.output_shapes) func_graph.to_function('MakeDataset', nil, nil, [optimize]) end end