C++ API¶
Abstruct¶
This chapter describes the C++ API
There is no detailed documentation available at this time, and the information to get an overview for readers is provided.
The BinaryBrain code has the name bb in the namespace.
Model class¶
Basic class¶
All layers are generated by deriving from the Model class.
Model class¶
Although abstract classes cannot be generated directly, they are the basis for each layer and define operations. It has the following methods.
- SendCommand()
- send command string to layer
- GetClassName()
- get class name
- set instance name.
- set instance name
- GetParameters()
- get parameters for optimizer
- GetGradients()
- get gradients for optimizer
- SetInputShape()
- set shape of the input-data
- Forward()
- run forward
- Backward()
- run backward
- PrintInfo()
- print structure of network
Activation layers¶
Binarize class¶
forward operation is binarize.backward operation is hard-tanh.
ReLU class¶
ReLU function.If you call SendCommand with “binary true”, it behaves as a Binarize layer
Sigmoid class¶
Sigmoid function.If you call SendCommand with “binary true”, it behaves as a Binarize layer
Operation layers¶
SparseLutN class¶
Layer to learn LUT using original model
StochasticLutN class¶
This is a layer to train the part corresponding to LUT of LUT-Network based on Stochastic model.Although Stochastic binary data is limited to learning to objects that have Stochastic properties, it is possible to train faster than SparseLut can.
MicroMlp class¶
This is a layer that uses the perceptron to learn the part corresponding to the LUT of the LUT-Network. The interior consists of three layers: MicroMlpAffine + BatchNormalization + Activation layer. Activation layer defaults to ReLU However, it can be changed with the template argument.
MicroMlpAffine class¶
It is a component of MicroMlp, a small MLP (Multi Layer Perceptron) aggregate with loose coupling with a limited number of inputs such as 6 and a hidden layer inside. The number of inputs and the number of hidden layers can be changed with template arguments.
DenseAffine class¶
Dense affine operation
BatchNormalization class¶
BatchNormalization operation
MaxPooling class¶
MaxPooling operation
LutLayer class¶
LUT Layer
BinaryLutN class¶
binary LUT operation (like FPGA)
Utility classes¶
Sequential class¶
constructer for sequential network
ConvolutionIm2 class¶
Im2Col operation layer
ConvolutionCol2Im class¶
Col2Im operation layer
BinaryModulation class¶
Binary modulation wrapper. (add RealToBinary(preprocess) and BinaryToReal(postprocess))
RealToBinary class¶
Binarize with modulation.
BinaryToReal class¶
Binary to Real with integration
Other classes¶
Loss function classes¶
LossSoftmaxCrossEntropy class¶
Softmax-CrossEntropy operation
LossMeanSquaredError class¶
calclate Mean Squared Error