Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
address reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
haojin2 committed Jul 15, 2019
1 parent c8bee52 commit c5e5363
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/operator/nn/softmax-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ inline void Softmax(Stream<cpu> *s, DType *in, OType *out,
index_t sa = stride[axis];

#pragma omp parallel for
for (int i = 0; i < static_cast<int>(N); ++i) {
for (index_t i = 0; i < N; ++i) {
index_t base = unravel_dot(i, sshape, stride);

DType mmax = negate ? -in[base] : in[base];
Expand Down Expand Up @@ -125,8 +125,8 @@ inline void SoftmaxWithLength(Stream<cpu> *s, DType *in, OType *out, IType *leng
index_t sa = stride[axis];

#pragma omp parallel for
for (int i = 0; i < static_cast<int>(N); ++i) {
IType len = length[i];
for (index_t i = 0; i < N; ++i) {
index_t len = static_cast<index_t>(length[i]);
index_t base = unravel_dot(i, sshape, stride);

DType mmax = negate ? -in[base] : in[base];
Expand All @@ -135,7 +135,7 @@ inline void SoftmaxWithLength(Stream<cpu> *s, DType *in, OType *out, IType *leng
val = negate ? -in[base + j*sa] : in[base + j*sa];
if (mmax < val) mmax = val;
}
for (int j = len; j < M; ++j) {
for (index_t j = len; j < M; ++j) {
out[base + j*sa] = OType(0.0f);
}

Expand Down Expand Up @@ -202,7 +202,7 @@ inline void SoftmaxGrad(Stream<cpu> *s, OType *out, OType *ograd,
index_t sa = stride[axis];

#pragma omp parallel for
for (int i = 0; i < static_cast<int>(N); ++i) {
for (index_t i = 0; i < N; ++i) {
index_t base = unravel_dot(i, sshape, stride);

AType sum = AType(0);
Expand Down Expand Up @@ -244,9 +244,9 @@ inline void SoftmaxWithLengthGrad(Stream<cpu> *s, OType *out, OType *ograd,
index_t sa = stride[axis];

#pragma omp parallel for
for (int i = 0; i < static_cast<int>(N); ++i) {
for (index_t i = 0; i < N; ++i) {
index_t base = unravel_dot(i, sshape, stride);
IType len = length[i];
index_t len = static_cast<index_t>(length[i]);

AType sum = AType(0);
for (index_t j = 0; j < len; ++j) {
Expand Down
1 change: 0 additions & 1 deletion tests/python/unittest/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7871,7 +7871,6 @@ def get_output_names_callback(name, arr):
except mx.base.MXNetError:
# skip errors since test is to check all names
pass
print(output_names)
for output_name, expected_name in zip(output_names, expected_names):
assert output_name == expected_name

Expand Down

0 comments on commit c5e5363

Please sign in to comment.