All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.komputation.cpu.network.CpuBackwardPropagator.kt Maven / Gradle / Ivy

Go to download

Komputation is a neural network framework for the JVM written in the Kotlin programming language.

There is a newer version: 0.12.5
Show newest version
package com.komputation.cpu.network

import com.komputation.cpu.layers.CpuEntryPoint
import com.komputation.cpu.layers.CpuForwardLayer

class CpuBackwardPropagator(
    private val entryPoint: CpuEntryPoint,
    private val layers : Array) {

    private val numberLayers = this.layers.size

    fun backward(withinBatch: Int, lossGradient: FloatArray) : FloatArray {

        var chain = lossGradient

        for(indexLayer in this.numberLayers - 1 downTo 0) {

            val layer = this.layers[indexLayer]

            chain = layer.backward(withinBatch, chain)

        }

        val result = this.entryPoint.backward(chain)

        return result

    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy