Class: TensorStream::ControlFlow

Inherits:
Operation show all
Defined in:
lib/tensor_stream/control_flow.rb

Overview

Defines a TensorStream controlflow op

Instance Attribute Summary collapse

Attributes inherited from Operation

#inputs, #name, #operation, #options, #outputs, #rank

Attributes inherited from Tensor

#breakpoint, #consumers, #data_type, #device, #given_name, #graph, #internal, #is_const, #name, #native_buffer, #outputs, #rank, #shape, #source, #value

Instance Method Summary collapse

Methods inherited from Operation

empty_matrix?, #infer_const, #op, #to_h, #to_math, #to_s

Methods inherited from Tensor

#!=, #*, #**, #+, #-, #-@, #/, #<, #<=, #==, #>, #>=, #[], #and, #auto_math, #breakpoint!, cast_dtype, #collect, detect_type, #dot, #dtype, #eval, #first, #internal?, #matmul, #op, #print!, reset_counters, #to_a, #to_f, #to_h, #to_i, #to_math, #to_s

Methods included from OpHelper

#_op, #cons, #dtype_eval, #format_source, #fp_type?, #i_cons, #i_op, #shape_eval, #val_to_dtype

Constructor Details

#initialize(flow_type, inputs, ops = nil, options = {}) ⇒ ControlFlow

Returns a new instance of ControlFlow.



6
7
8
9
10
11
12
13
14
15
# File 'lib/tensor_stream/control_flow.rb', line 6

def initialize(flow_type, inputs, ops = nil, options = {})
  setup_initial_state(options)

  @operation = :"flow_#{flow_type}"
  @inputs = inputs
  @name = [@graph.get_name_scope, options[:name] || set_name].compact.join('/')
  @ops = ops
  @shape = TensorShape.new([inputs.size])
  @graph.add_node(self)
end

Instance Attribute Details

#opsObject

Returns the value of attribute ops.



4
5
6
# File 'lib/tensor_stream/control_flow.rb', line 4

def ops
  @ops
end

Instance Method Details

#runObject



21
22
23
# File 'lib/tensor_stream/control_flow.rb', line 21

def run
  eval
end

#set_data_type(_passed_data_type) ⇒ Object



17
18
19
# File 'lib/tensor_stream/control_flow.rb', line 17

def set_data_type(_passed_data_type)
  :unknown
end