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 0023355 commit b719b63
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/main/scala/BIDMach/networks/layers/ModelLayer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,21 @@ import scala.util.hashing.MurmurHash3;
import java.util.HashMap;
import BIDMach.networks._

/**
* Assign an integer id (imodel) which points to the model matrix (or matrices) used by this layer.
* nmats is the number of model matrices use by this layer. When multiple model matrices are used,
* they are assumed to be consecutive.
* If using named model layers, the model layer name is augmented with "_i" for matrices >= 1.
*/


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 = {
imodel = if (net.opts.nmodelmats > 0) { // If explicit model numbers are given, use them.
imodel = if (net.opts.nmodelmats > 0) { // If explicit model numbers are given, use them.
opts.imodel;
} else if (opts.modelName.length > 0) { // If this is a named layer, look it up.
} else if (opts.modelName.length > 0) { // If this is a named layer, look it up.
if (net.modelMap.containsKey(opts.modelName)) {
net.modelMap.get(opts.modelName);
} else {
Expand All @@ -32,7 +39,7 @@ class ModelLayer(override val net:Net, override val opts:ModelNodeOpts = new Mod
}
len;
}
} else { // Otherwise return the next available int
} else { // Otherwise return the next available int
net.imodel += nmats;
net.imodel - nmats;
};
Expand Down

0 comments on commit b719b63

Please sign in to comment.