Skip to content

Commit

Permalink
support multiple modelmats in model layers
Browse files Browse the repository at this point in the history
  • Loading branch information
jcanny committed Dec 26, 2016
1 parent 54053f9 commit 0023355
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/scala/BIDMach/networks/layers/ModelLayer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import java.util.HashMap;
import BIDMach.networks._


class ModelLayer(override val net:Net, override val opts:ModelNodeOpts = new ModelNode) extends Layer(net, opts) {
class ModelLayer(override val net:Net, override val opts:ModelNodeOpts = new ModelNode, val nmats:Int = 1) extends Layer(net, opts) {
var imodel = 0;

override def getModelMats(net:Net):Unit = {
Expand All @@ -27,11 +27,14 @@ class ModelLayer(override val net:Net, override val opts:ModelNodeOpts = new Mod
} else {
val len = net.modelMap.size;
net.modelMap.put(opts.modelName, len + net.opts.nmodelmats);
for (i <- 1 until nmats) {
net.modelMap.put(opts.modelName+"_%d" format i, len + i + net.opts.nmodelmats);
}
len;
}
} else { // Otherwise return the next available int
net.imodel += 1;
net.imodel - 1;
net.imodel += nmats;
net.imodel - nmats;
};
}
}
Expand Down

0 comments on commit 0023355

Please sign in to comment.