Class: TensorStream::DynamicStitch

Inherits:
Operation show all
Defined in:
lib/tensor_stream/dynamic_stitch.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

#infer_const, #op, #to_h, #to_math, #to_s

Methods inherited from Tensor

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

Methods included from OpHelper

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

Constructor Details

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

Returns a new instance of DynamicStitch.



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

def initialize(flow_type, inputs, ops = nil, options = {})
  setup_initial_state(options)
  
  @operation = :"flow_#{flow_type}"
  @inputs = inputs

  @data_type = Tensor.detect_type(inputs[1])
  @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/dynamic_stitch.rb', line 4

def ops
  @ops
end

Instance Method Details

#runObject



23
24
25
# File 'lib/tensor_stream/dynamic_stitch.rb', line 23

def run
  eval
end

#set_data_type(_passed_data_type) ⇒ Object



19
20
21
# File 'lib/tensor_stream/dynamic_stitch.rb', line 19

def set_data_type(_passed_data_type)
  :unknown
end