advise for implement a C++ layer
hi, I'm writing a NCE loss in C++, the forward is easy, but backward is some hard to me, the formula as below:
ograd[i,j,k] = -y[i,j,k] / ( y[i,j,k] + k*pn[i,j,k] )
ograd[0, :, :] += 1.0
I'm writing with softmax_output as template, using the old style(previous 0.9.0) as here, because the tutorial told little about how to make a loss layer
I'm a newbie to mxnet and cuda&cudnn, and only know 2 possible solution:
- using cuda and openmp to write for loop
- using mshadow (just guess)
are there any better solution?
where can I find document about how to do this more quickly, or, which can I take as example
thanks for any help
You can use the kernel::launch mechanism: https://github.com/dmlc/mxnet/blob/master/src/operator/tensor/indexing_op.h#L200
@piiswrong , tks, I'lll have a try
missing complete
@piiswrong, thanks