org.encog.engine.opencl.kernels
Class KernelNetworkTrain

java.lang.Object
  extended by org.encog.engine.opencl.kernels.EncogKernel
      extended by org.encog.engine.opencl.kernels.KernelNetworkTrain

public class KernelNetworkTrain
extends EncogKernel

An OpenCL kernel that is designed to calculate gradients and help train a neural network.


Field Summary
static int PARRAY_INPUT_COUNT
          The input count.
static int PARRAY_ITEMS_PER
          Items to train per call.
static int PARRAY_ITERATIONS
          Items to train per call.
static int PARRAY_LAYER_COUNT
          The layer count.
static int PARRAY_LEARN
          Are we learning? 0=no, 1 =yes.
static int PARRAY_OUTPUT_COUNT
          The output count.
static int PARRAY_START
          What is the starting index to train at.
 
Constructor Summary
KernelNetworkTrain(EncogCLDevice device, FlatNetwork flat, EngineIndexableSet training, int tempDataSize)
          Construct a kernel to train the network.
 
Method Summary
 void assignWorkgroupSizes(int trainingSize, int requestedGlobalSize)
          Assign the workgroup sizes based on the training set size.
 void calculate(int start, int size, boolean learn, int iterations)
          Calculate one iteration over the specified range.
 void compile(Map<String,String> options, OpenCLTrainingProfile profile, FlatNetwork network)
          Compile the kernel.
 float[] getErrors()
           
 float[] getTempDataArray()
           
 float[] getWeightOutArray()
           
 void init(OpenCLTrainingProfile profile)
          Setup the kernel.
 void release()
          Release the kernel and all buffers.
 void setTempDataArray(float[] tempDataArray)
           
 
Methods inherited from class org.encog.engine.opencl.kernels.EncogKernel
compile, compile, createArrayReadOnly, createArrayReadOnly, createFloatArrayWriteOnly, getCLSource, getContext, getDevice, getGlobalWork, getKernel, getLocalWork, getMaxWorkGroupSize, getProgram, getSourceName, getWorkGroupLong, prepareKernel, releaseBuffer, setArg, setCLSource, setGlobalWork, setLocalWork
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARRAY_INPUT_COUNT

public static final int PARRAY_INPUT_COUNT
The input count.

See Also:
Constant Field Values

PARRAY_OUTPUT_COUNT

public static final int PARRAY_OUTPUT_COUNT
The output count.

See Also:
Constant Field Values

PARRAY_LAYER_COUNT

public static final int PARRAY_LAYER_COUNT
The layer count.

See Also:
Constant Field Values

PARRAY_LEARN

public static final int PARRAY_LEARN
Are we learning? 0=no, 1 =yes.

See Also:
Constant Field Values

PARRAY_START

public static final int PARRAY_START
What is the starting index to train at.

See Also:
Constant Field Values

PARRAY_ITEMS_PER

public static final int PARRAY_ITEMS_PER
Items to train per call.

See Also:
Constant Field Values

PARRAY_ITERATIONS

public static final int PARRAY_ITERATIONS
Items to train per call.

See Also:
Constant Field Values
Constructor Detail

KernelNetworkTrain

public KernelNetworkTrain(EncogCLDevice device,
                          FlatNetwork flat,
                          EngineIndexableSet training,
                          int tempDataSize)
Construct a kernel to train the network.

Parameters:
device - The OpenCL device to use.
flat - The network to train.
training - The training data.
tempDataSize - How much temp data.
Method Detail

assignWorkgroupSizes

public void assignWorkgroupSizes(int trainingSize,
                                 int requestedGlobalSize)
Assign the workgroup sizes based on the training set size.

Parameters:
trainingSize - The training set size.
requestedGlobalSize - The requested global size.

calculate

public void calculate(int start,
                      int size,
                      boolean learn,
                      int iterations)
Calculate one iteration over the specified range.

Parameters:
start - The starting position to calculate for.
size - The ending position to calculate for.
iterations - The number of iterations to execute.
learn - True, if we should learn.

compile

public void compile(Map<String,String> options,
                    OpenCLTrainingProfile profile,
                    FlatNetwork network)
Compile the kernel.

Parameters:
options - The options.
profile - The OpenCL training profile.
network - The network to compile for.

getErrors

public float[] getErrors()
Returns:
the errors

getTempDataArray

public float[] getTempDataArray()
Returns:
the tempDataArray

getWeightOutArray

public float[] getWeightOutArray()
Returns:
the weightOutArray

init

public void init(OpenCLTrainingProfile profile)
Setup the kernel.

Parameters:
profile - The OpenCL training profile.

release

public void release()
Release the kernel and all buffers.

Overrides:
release in class EncogKernel

setTempDataArray

public void setTempDataArray(float[] tempDataArray)
Parameters:
tempDataArray - the tempDataArray to set


Copyright © 2011. All Rights Reserved.