Skip to content

Commit

Permalink
Merge pull request apache#117 from ranjanan/ranjanan-depwarn
Browse files Browse the repository at this point in the history
Get rid of `sub` depwarn
  • Loading branch information
pluskid authored Aug 22, 2016
2 parents 8c22211 + 08ba2d1 commit de77bce
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
julia 0.4+
Compat
Compat 0.8.4
Formatting
BinDeps
JSON
1 change: 1 addition & 0 deletions src/MXNet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module mx

using Compat
import Compat.String
import Compat.view

using Formatting

Expand Down
4 changes: 2 additions & 2 deletions src/metric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function _update_single_output(metric :: Accuracy, label :: NDArray, pred :: NDA
for j in 1:size(labels, 2)
for i in 1:size(labels, 1)
label = labels[i, j, 1, sample]
klasses = sub(pred, i, j, :, sample)
klasses = view(pred, i, j, :, sample)
klass = indmax(klasses) - 1 # Classes start at 0...k-1

metric.acc_sum += klass == label
Expand All @@ -79,7 +79,7 @@ function _update_single_output(metric :: Accuracy, label :: NDArray, pred :: NDA
end
elseif ndims(pred) == 2 # 1-dimensional case
for sample in 1:size(label, 1)
klass = indmax(sub(pred, :, sample)) - 1
klass = indmax(view(pred, :, sample)) - 1
metric.acc_sum += klass == label[sample]
metric.n_sample += 1
end
Expand Down

0 comments on commit de77bce

Please sign in to comment.