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

#breakpoint, #consumers, #data_type, #device, #inputs, #is_const, #name, #operation, #options, #outputs, #rank, #shape

Attributes inherited from Tensor

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

Instance Method Summary collapse

Methods inherited from Operation

#const_value, #container_buffer, #infer_const, #inspect, #op, #set_input, #set_name, #set_option, #to_h, #to_math, #to_s

Methods included from OpHelper

#_op, #cons, #format_source, #fp_type?, #i_cons, #i_op, #i_var, #int_type?, #reduced_shape, #shape_eval, #shape_full_specified, #shapes_fully_specified_and_equal

Methods inherited from Tensor

#auto_math, #breakpoint!, cast_dtype, #collect, #consumers, detect_type, #device, #dtype, #eval, #first, #inspect, #internal?, #print!, reset_counters, #to_a, #to_f, #to_h, #to_i, #to_math, #to_s

Methods included from TensorMixins

#!=, #%, #*, #**, #+, #-, #-@, #/, #<, #<=, #==, #>, #>=, #[], #and, #cast, #ceil, #dot, #floor, #log, #matmul, #reduce, #reshape, #round, #var, #zero?

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
16
# File 'lib/tensor_stream/control_flow.rb', line 6

def initialize(flow_type, inputs, ops = nil, options = {})
  setup_initial_state(options)
  @options = options
  @operation = :"flow_#{flow_type}"
  @inputs = inputs
  @name = [@graph.get_name_scope, options[:name] || set_name].compact.join("/")
  @ops = ops
  @consumers = Set.new
  @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



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