Zha0q1 commented on pull request #19067:
URL: https://github.com/apache/incubator-mxnet/pull/19067#issuecomment-723394792
Regarding the type conversion on the gpu path for operator `det` and
`slogdet`, maybe we can use a kernel like this:
```c++
struct CopyArray {
template<typename SType, typename DType>
MSHADOW_XINLINE static void Map(size_t i, SType* src, DType* dest) {
dest[i] = src[i];
}
};
......
// in det forward
if (std::is_same<xpu, gpu>::value && !std::is_same<IndexT, int>::value) {
using IndexInternalT = typename LapackIndex<xpu>::IndexT;
Tensor<xpu, 2, IndexInternalT> workspace =
ctx.requested[0].get_space_typed<xpu, 2,
IndexInternalT>(pivot.shape_, s);
linalg_batch_getrf(LU, workspace, false, s);
Kernel<CopyArray, xpu>::Launch(s, pivot.shape_.Size(),
workspace.dptr_, pivot.dptr_);
} else {
linalg_batch_getrf(LU, pivot, false, s);
}
```
----------------------------------------------------------------
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:
[email protected]