singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-singa] chrishkchris edited a comment on issue #488: SINGA -475 add Sign operator to singa
Date Fri, 09 Aug 2019 10:27:33 GMT
chrishkchris edited a comment on issue #488: SINGA -475 add Sign operator to singa
URL: https://github.com/apache/incubator-singa/pull/488#issuecomment-519866518
 
 
   This is what tensorflow use: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/cc/gradients/math_grad.cc#L268
   ```cpp
   Status SignGrad(const Scope& scope, const Operation& op,
                   const std::vector<Output>& grad_inputs,
                   std::vector<Output>* grad_outputs) {
     auto shape = Shape(scope, op.input(0));
     auto zero = Cast(scope, Const(scope, 0.0), op.input(0).type());
     auto dx = Fill(scope, shape, zero);
     grad_outputs->push_back(dx);
     return scope.status();
   }
   REGISTER_GRADIENT_OP("Sign", SignGrad);
   ```
   seems to fill the dx with all zero using the dy shape

----------------------------------------------------------------
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


With regards,
Apache Git Services

Mime
View raw message