Module: TensorStream::Evaluator

Defined in:
lib/tensor_stream/evaluator/base_evaluator.rb,
lib/tensor_stream/evaluator/evaluator.rb,
lib/tensor_stream/evaluator/ruby_evaluator.rb

Overview

Evaluator base module

Defined Under Namespace

Classes: BaseEvaluator, EvaluatorExcecutionException, FullEvalNotPossible, OutputGroup, RubyEvaluator, UnsupportedOp

Class Method Summary collapse

Class Method Details

.clear_storages(graph) ⇒ Object



240
241
242
# File 'lib/tensor_stream/evaluator/base_evaluator.rb', line 240

def self.clear_storages(graph)
  @storage_managers.values.each { |manager| manager.clear_variables(graph) }
end

.default_evaluatorsObject



236
237
238
# File 'lib/tensor_stream/evaluator/base_evaluator.rb', line 236

def self.default_evaluators
  evaluators.values.sort { |v| v[:index] }.reverse.map { |v| v[:class] }
end

.evaluatorsObject



225
226
227
# File 'lib/tensor_stream/evaluator/base_evaluator.rb', line 225

def self.evaluators
  @evaluators ||= {}
end

.read_variable(graph, name) ⇒ Object



244
245
246
247
248
249
250
# File 'lib/tensor_stream/evaluator/base_evaluator.rb', line 244

def self.read_variable(graph, name)
  @storage_managers.values.each do |manager|
    return manager.read_value(graph, name) if manager.exists?(graph, name)
  end

  nil
end

.register_evaluator(klass, name, index = 0) ⇒ Object



229
230
231
232
233
234
# File 'lib/tensor_stream/evaluator/base_evaluator.rb', line 229

def self.register_evaluator(klass, name, index = 0)
  @evaluators ||= {}
  @storage_managers ||= {}
  @evaluators[name] = {name: name, class: klass, index: index}
  @storage_managers[klass] = klass.get_storage_manager
end