Class: TensorStream::Placeholder

Inherits:
Tensor
  • Object
show all
Defined in:
lib/tensor_stream/placeholder.rb

Overview

Class that defines a TensorStream placeholder

Instance Attribute Summary

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 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(data_type, rank, shape, options = {}) ⇒ Placeholder

Returns a new instance of Placeholder.



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

def initialize(data_type, rank, shape, options = {})
  @graph = options[:graph] || TensorStream.get_default_graph

  @data_type = data_type
  @rank = rank
  @shape = TensorShape.new(shape, rank)
  @value = nil
  @is_const = false
  @source = format_source(caller_locations)

  @name = options[:name] || build_name
  @graph.add_node(self)
end