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

cuda.optimization.adaptive.RmspropKernel.cu 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
__global__ void rmspropKernel (
    int numberIterations,
    int* parameterIndices,
    int* counts,
    int parameterSize,
    float* parameters,
    float* gradient,
    float learningRate,
    float decay,
    float oneMinusDecay,
    float epsilon,
    float* accumulation) {

    int startEntry = (blockIdx.y * blockDim.x * numberIterations) + threadIdx.x * numberIterations;

    if(startEntry < parameterSize) {

        int gradientIndex = blockIdx.x;
        int parameterIndex = parameterIndices[gradientIndex];

        if(parameterIndex != -1) {

            int startParameter = parameterIndex * parameterSize + startEntry;
            int startGradient = gradientIndex * parameterSize + startEntry;

            for(int indexParameter = startParameter, indexGradient = startGradient; indexParameter < startParameter + numberIterations; indexParameter++, indexGradient++) {

                float derivative = gradient[indexGradient];

                float updatedAccumulation = decay * accumulation[indexParameter] + oneMinusDecay * (derivative * derivative);
                accumulation[indexParameter] = updatedAccumulation;

                float adaptiveLearningRate = learningRate / sqrtf(updatedAccumulation + epsilon);
                float update = -adaptiveLearningRate * derivative;

                parameters[indexParameter] += update;

            }

        }

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy