Hi there,
I am trying to implement a new operator in MXNet. The new operator is taking a weight parameter is instantiated for several iterations. Because of this, I am hoping that the gradient request returned by the backward interface should be kAddto
:
virtual void Backward(const OpContext &ctx,
const std::vector<TBlob> &out_grad,
const std::vector<TBlob> &in_data,
const std::vector<TBlob> &out_data,
const std::vector<OpReqType> &req,
const std::vector<TBlob> &in_grad,
const std::vector<TBlob> &aux_args) {
// req[EnumOpInput::Weight] should be kAddTo, but is kWriteTo instead.
}
However, it turns out that the actual returned gradient request type is kWriteTo
and I do not understand the reason why. Could someone please kindly offer me some help? Thanks.