Class: Neuronet::InputLayer

Inherits:
Object
  • Object
show all
Includes:
Arrayable
Defined in:
lib/neuronet/input_layer.rb

Overview

Input Layer

Instance Method Summary collapse

Methods included from Arrayable

#[], #each, #each_with_index, #map, #reverse, #size

Constructor Details

#initialize(length, input_neuron: InputNeuron) ⇒ InputLayer

Returns a new instance of InputLayer.



8
9
10
11
# File 'lib/neuronet/input_layer.rb', line 8

def initialize(length, input_neuron: InputNeuron)
  @layer = Array.new(length) { input_neuron.new }
  @endex = length - 1
end

Instance Method Details

#set(values) ⇒ Object



13
14
15
# File 'lib/neuronet/input_layer.rb', line 13

def set(values)
  0.upto(@endex) { @layer[it].set values[it] }
end

#to_aObject



17
# File 'lib/neuronet/input_layer.rb', line 17

def to_a = @layer