Sha256: 6fb28d1f96697c2fd52e82add81d40cbf271be21c489ce511403cf18228f6726

Contents?: true

Size: 318 Bytes

Versions: 1

Compression:

Stored size: 318 Bytes

Contents

# frozen_string_literal: true

module Micrograd
  class Layer
    def initialize(inputs, outputs)
      @neurons = Array.new(outputs) { Neuron.new(inputs) }
    end

    attr_reader :neurons

    def call(xs)
      @neurons.map { |n| n.call(xs) }
    end

    def parameters = neurons.flat_map(&:parameters)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
micrograd-0.1.0 lib/micrograd/layer.rb