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

#items, #name, #operation, #options, #rank

Attributes inherited from Tensor

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

Instance Method Summary collapse

Methods inherited from Operation

empty_matrix?, #to_h, #to_math, #to_s

Methods inherited from Tensor

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

Methods included from OpHelper

#cons, #dtype_eval, #fp_type?, #i_cons, #i_op, #op, #shape_eval, #val_to_dtype

Constructor Details

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

Returns a new instance of ControlFlow.



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

def initialize(flow_type, items, ops = nil, options = {})
  @graph = options[:graph] || TensorStream.get_default_graph

  @operation = :"flow_#{flow_type}"
  @items = items
  @name = set_name
  @ops = ops
  @source = format_source(caller_locations)

  @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



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

def run
  eval
end

#set_data_type(_passed_data_type) ⇒ Object



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

def set_data_type(_passed_data_type)
  :unknown
end