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.



83
84
85
86
# File 'lib/dnn/core/layers.rb', line 83

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

Instance Attribute Details

#shape ⇒ Object (readonly)

Returns the value of attribute shape.



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

def shape
  @shape
end

Class Method Details

.load_hash(hash) ⇒ Object



79
80
81
# File 'lib/dnn/core/layers.rb', line 79

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

Instance Method Details

#backward(dout) ⇒ Object



92
93
94
# File 'lib/dnn/core/layers.rb', line 92

def backward(dout)
  dout
end

#forward(x) ⇒ Object



88
89
90
# File 'lib/dnn/core/layers.rb', line 88

def forward(x)
  x
end

#to_hash ⇒ Object



96
97
98
# File 'lib/dnn/core/layers.rb', line 96

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