Class: DNN::Layers::InputLayer

Inherits:
Layer
  • Object
show all
Defined in:
lib/dnn/core/layers.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Layer

#build, #built?, #prev_layer

Constructor Details

#initialize(dim_or_shape) ⇒ InputLayer

Returns a new instance of InputLayer.



81
82
83
84
# File 'lib/dnn/core/layers.rb', line 81

def initialize(dim_or_shape)
  super()
  @shape = dim_or_shape.is_a?(Array) ? dim_or_shape : [dim_or_shape]
end

Instance Attribute Details

#shapeObject (readonly)

Returns the value of attribute shape.



75
76
77
# File 'lib/dnn/core/layers.rb', line 75

def shape
  @shape
end

Class Method Details

.load_hash(hash) ⇒ Object



77
78
79
# File 'lib/dnn/core/layers.rb', line 77

def self.load_hash(hash)
  self.new(hash[:shape])
end

Instance Method Details

#backward(dout) ⇒ Object



90
91
92
# File 'lib/dnn/core/layers.rb', line 90

def backward(dout)
  dout
end

#forward(x) ⇒ Object



86
87
88
# File 'lib/dnn/core/layers.rb', line 86

def forward(x)
  x
end

#to_hashObject



94
95
96
# File 'lib/dnn/core/layers.rb', line 94

def to_hash
  super({shape: @shape})
end