You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2020/06/22 16:29:50 UTC
[GitHub] [incubator-mxnet] goldmermaid opened a new pull request #18603: DeepNumpy HuberLoss
goldmermaid opened a new pull request #18603:
URL: https://github.com/apache/incubator-mxnet/pull/18603
Base on D2L users' requirement, add huberloss feature for deepnumpy.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-mxnet] sxjscience commented on a change in pull request #18603: DeepNumpy HuberLoss
Posted by GitBox <gi...@apache.org>.
sxjscience commented on a change in pull request #18603:
URL: https://github.com/apache/incubator-mxnet/pull/18603#discussion_r444507043
##########
File path: python/mxnet/gluon/loss.py
##########
@@ -650,9 +650,22 @@ def __init__(self, margin=1, weight=None, batch_axis=0, **kwargs):
def hybrid_forward(self, F, pred, label, sample_weight=None):
label = _reshape_like(F, label, pred)
- loss = F.relu(self._margin - pred * label)
- loss = _apply_weighting(F, loss, self._weight, sample_weight)
- return F.mean(loss, axis=self._batch_axis, exclude=True)
+
+ if is_np_array():
+ loss = F.np.abs(label - pred)
+ loss = F.np.where(loss > self._rho, loss - 0.5 * self._rho,
+ (0.5 / self._rho) * F.np.square(loss))
+ loss = _apply_weighting(F, loss, self._weight, sample_weight)
+ if F is ndarray:
+ return F.np.mean(loss, axis=tuple(range(1, loss.ndim)))
+ else:
+ return F.npx.batch_flatten(loss).mean(axis=1)
Review comment:
This won't work for arbitrary batch axis.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #18603: DeepNumpy HuberLoss
Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #18603:
URL: https://github.com/apache/incubator-mxnet/pull/18603#issuecomment-647631317
Hey @goldmermaid , Thanks for submitting the PR
All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands:
- To trigger all jobs: @mxnet-bot run ci [all]
- To trigger specific jobs: @mxnet-bot run ci [job1, job2]
***
**CI supported jobs**: [unix-gpu, website, sanity, windows-cpu, centos-gpu, windows-gpu, clang, miscellaneous, edge, centos-cpu, unix-cpu]
***
_Note_:
Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin.
All CI tests must pass before the PR can be merged.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org