Sha256: 1fcb82fb1d07bdf3e10edd2fe574e44d2a4e986478fa1a16661b5fec07bd8ad2

Contents?: true

Size: 797 Bytes

Versions: 7

Compression:

Stored size: 797 Bytes

Contents

module TensorStream
  # Class that defines a TensorStream placeholder
  class Placeholder < Tensor
    def initialize(data_type, rank, shape, options = {})
      setup_initial_state(options)

      @data_type = DataTypeUtils.norm_dtype(data_type.to_sym)
      @rank = rank
      @shape = TensorShape.new(shape, rank)
      @value = nil
      @is_const = false

      @name = [@graph.get_name_scope, options[:name] || build_name].compact.reject(&:empty?).join("/")
      @op = Graph.get_default_graph.add_op!(:placeholder, data_type: @data_type, shape: @shape, internal_name: @name)
    end

    def inspect
      "Placeholder(#{@name} shape: #{@shape || "?"} data_type: #{@data_type})"
    end

    private

    def build_name
      "Placeholder#{graph.get_placeholder_counter}"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tensor_stream-1.0.9 lib/tensor_stream/placeholder.rb
tensor_stream-1.0.8 lib/tensor_stream/placeholder.rb
tensor_stream-1.0.7 lib/tensor_stream/placeholder.rb
tensor_stream-1.0.6 lib/tensor_stream/placeholder.rb
tensor_stream-1.0.5 lib/tensor_stream/placeholder.rb
tensor_stream-1.0.4 lib/tensor_stream/placeholder.rb
tensor_stream-1.0.3 lib/tensor_stream/placeholder.rb