Repository: systemml
Updated Branches:
  refs/heads/master ca5581fcc -> b2700839b


[SYSTEMML-540] [MINOR] Bugfix for SoftMaxWithLoss layer in Caffe2DML

- This commit allows users to specify the bottom of SoftMaxWithLoss in
any order they prefer, thereby avoiding subtle bugs


Project: http://git-wip-us.apache.org/repos/asf/systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/b2700839
Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/b2700839
Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/b2700839

Branch: refs/heads/master
Commit: b2700839b77293cc32e88aaec9cdfcb3223619af
Parents: ca5581f
Author: Niketan Pansare <npan...@us.ibm.com>
Authored: Thu Aug 10 12:39:01 2017 -0800
Committer: Niketan Pansare <npan...@us.ibm.com>
Committed: Thu Aug 10 13:39:00 2017 -0700

----------------------------------------------------------------------
 src/main/scala/org/apache/sysml/api/dl/CaffeLayer.scala | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/b2700839/src/main/scala/org/apache/sysml/api/dl/CaffeLayer.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/org/apache/sysml/api/dl/CaffeLayer.scala 
b/src/main/scala/org/apache/sysml/api/dl/CaffeLayer.scala
index 9518d75..cbd5fa3 100644
--- a/src/main/scala/org/apache/sysml/api/dl/CaffeLayer.scala
+++ b/src/main/scala/org/apache/sysml/api/dl/CaffeLayer.scala
@@ -552,6 +552,14 @@ class SoftmaxWithLoss(val param:LayerParameter, val 
id:Int, val net:CaffeNetwork
   override def weightShape():Array[Int] = null
   override def biasShape():Array[Int] = null
   // -------------------------------------------------
+  override def bottomLayerOutputShape:(String, String, String) = {
+    if(computedBottomLayerOutputShape == null) {
+      val ret = net.getBottomLayers(param.getName).map(l => 
net.getCaffeLayer(l)).filter(l => !l.isInstanceOf[Data]).toList
+      if(ret.size != 1) throw new LanguageException("Expected exactly 1 bottom 
non-Data layer for " + param.getName)
+      computedBottomLayerOutputShape = ret(0).outputShape
+    }
+    computedBottomLayerOutputShape
+  }
 }
 
 class ReLU(val param:LayerParameter, val id:Int, val net:CaffeNetwork) extends 
CaffeLayer {

Reply via email to