com.komputation.loss.LogisticLoss.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.loss
import com.komputation.cpu.loss.CpuLogisticLoss
import com.komputation.cuda.CudaContext
import com.komputation.cuda.kernels.LossKernels
import com.komputation.cuda.loss.CudaLogisticLoss
class LogisticLoss(private val numberColumns: Int) : CpuLossFunctionInstruction, CudaLossFunctionInstruction {
override fun buildForCpu() =
CpuLogisticLoss(this.numberColumns)
override fun buildForCuda(context: CudaContext) =
CudaLogisticLoss(
this.numberColumns,
{ context.createKernel(LossKernels.logisticLoss()) },
{ context.createKernel(LossKernels.backwardLogisticLoss()) },
context.numberMultiprocessors,
context.maximumNumberOfResidentWarpsPerMultiprocessor,
context.warpSize,
context.maximumNumberOfThreadsPerBlock)
}
fun logisticLoss(length: Int = 1) =
LogisticLoss(length)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy