Commit 61929cc6 authored by Evgeny Kusmenko's avatar Evgeny Kusmenko
Browse files

Merge branch 'added_emadl_model_lenet' into 'master'

Added emadl model mnist

See merge request !11
parents 1fde5334 b0668acb
Pipeline #81267 passed with stages
in 4 minutes and 44 seconds
package mnist;
component ArgMax<Z(1:oo) n = 2>{
ports in Q^{n} inputVector,
out Z(0:oo) maxIndex,
out Q maxValue;
implementation Math{
maxIndex = 0;
maxValue = inputVector(1);
for i = 2:n
if inputVector(i) > maxValue
maxIndex = i - 1;
maxValue = inputVector(i);
end
end
}
}
\ No newline at end of file
configuration LeNetNetwork{
num_epoch:1000
batch_size:256
context:gpu
eval_metric:accuracy
optimizer:adam{
learning_rate:0.001
learning_rate_policy:fixed
weight_decay:0.001
epsilon:0.00000001
beta1:0.9
beta2:0.999
}
}
package mnist;
component LeNetNetwork<Z(2:oo) classes = 10>{
ports in Z(0:255)^{1, 28, 28} image,
out Q(0:1)^{classes} predictions;
implementation CNN {
image ->
Convolution(kernel=(5,5), channels=20, padding="valid") ->
Pooling(pool_type="max", kernel=(2,2), stride=(2,2), padding="valid") ->
Convolution(kernel=(5,5), channels=50, padding="valid") ->
Pooling(pool_type="max", kernel=(2,2), stride=(2,2), padding="valid") ->
FullyConnected(units=500) ->
Relu() ->
FullyConnected(units=classes) ->
Softmax() ->
predictions
}
}
package mnist;
import Network;
import CalculateClass;
component MnistClassifier{
ports in Z(0:255)^{1, 28, 28} image,
out Z(0:9) classIndex,
out Q probability;
instance LeNetNetwork<10> net;
instance ArgMax<10> calculateClass;
connect image -> net.image;
connect net.predictions -> calculateClass.inputVector;
connect calculateClass.maxIndex -> classIndex;
connect calculateClass.maxValue -> probability;
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment