com.komputation.cpu.network.CpuBackwardPropagator.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of komputation Show documentation
Show all versions of komputation Show documentation
Komputation is a neural network framework for the JVM written in the Kotlin programming language.
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