Repository: incubator-systemml Updated Branches: refs/heads/master f38140baf -> 919d919be
SystemML-NN: Replacing the deprecated `ppred` function with direct relational operators. Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/919d919b Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/919d919b Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/919d919b Branch: refs/heads/master Commit: 919d919be4375cda951eb4e851b151e989208bf3 Parents: f38140b Author: Mike Dusenberry <[email protected]> Authored: Fri Jun 10 11:55:22 2016 -0700 Committer: Mike Dusenberry <[email protected]> Committed: Fri Jun 10 11:55:22 2016 -0700 ---------------------------------------------------------------------- scripts/staging/SystemML-NN/nn/layers/max_pool.dml | 5 ++--- scripts/staging/SystemML-NN/nn/test/max_pool_simple.dml | 5 ++--- scripts/staging/SystemML-NN/nn/util.dml | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/919d919b/scripts/staging/SystemML-NN/nn/layers/max_pool.dml ---------------------------------------------------------------------- diff --git a/scripts/staging/SystemML-NN/nn/layers/max_pool.dml b/scripts/staging/SystemML-NN/nn/layers/max_pool.dml index 5dc4638..94f93e2 100644 --- a/scripts/staging/SystemML-NN/nn/layers/max_pool.dml +++ b/scripts/staging/SystemML-NN/nn/layers/max_pool.dml @@ -117,9 +117,8 @@ backward = function(matrix[double] dout, int Hout, int Wout, matrix[double] X, i for (wout in 1:Wout) { # all output columns win = (wout-1) * stridew + 1 img_slice_patch = img_slice[hin:hin+Hf-1, win:win+Wf-1] - max_val = max(img_slice_patch) - max_val_ind = ppred(img_slice_patch, max_val, "==") # max value indicator - # gradient passes through only for the max value in this patch + max_val_ind = img_slice_patch == max(img_slice_patch) # max value indicator matrix + # gradient passes through only for the max value(s) in this patch dimg_slice_patch = max_val_ind * dout[n, (c-1)*Hout*Wout + (hout-1)*Wout + wout] dimg_slice[hin:hin+Hf-1, win:win+Wf-1] = dimg_slice[hin:hin+Hf-1, win:win+Wf-1] + dimg_slice_patch http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/919d919b/scripts/staging/SystemML-NN/nn/test/max_pool_simple.dml ---------------------------------------------------------------------- diff --git a/scripts/staging/SystemML-NN/nn/test/max_pool_simple.dml b/scripts/staging/SystemML-NN/nn/test/max_pool_simple.dml index 2f90779..08938e5 100644 --- a/scripts/staging/SystemML-NN/nn/test/max_pool_simple.dml +++ b/scripts/staging/SystemML-NN/nn/test/max_pool_simple.dml @@ -114,9 +114,8 @@ backward = function(matrix[double] dout, int Hout, int Wout, matrix[double] X, i for (wout in 1:Wout) { # all output columns win = (wout-1) * stridew + 1 img_slice_patch = img_slice[hin:hin+Hf-1, win:win+Wf-1] - max_val = max(img_slice_patch) - max_val_ind = ppred(img_slice_patch, max_val, "==") # max value indicator - # gradient passes through only for the max value in this patch + max_val_ind = img_slice_patch == max(img_slice_patch) # max value indicator matrix + # gradient passes through only for the max value(s) in this patch dimg_slice_patch = max_val_ind * dout[n, (c-1)*Hout*Wout + (hout-1)*Wout + wout] dimg_slice[hin:hin+Hf-1, win:win+Wf-1] = dimg_slice[hin:hin+Hf-1, win:win+Wf-1] + dimg_slice_patch http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/919d919b/scripts/staging/SystemML-NN/nn/util.dml ---------------------------------------------------------------------- diff --git a/scripts/staging/SystemML-NN/nn/util.dml b/scripts/staging/SystemML-NN/nn/util.dml index 213363b..3f4d97b 100644 --- a/scripts/staging/SystemML-NN/nn/util.dml +++ b/scripts/staging/SystemML-NN/nn/util.dml @@ -34,7 +34,7 @@ all_equal = function(matrix[double] X1, matrix[double] X2) * Outputs: * - equivalent: Whether or not the two matrices are equivalent. */ - equivalent = as.logical(prod(ppred(X1, X2, "=="))) + equivalent = as.logical(prod(X1 == X2)) } check_all_equal = function(matrix[double] X1, matrix[double] X2)
