apeforest commented on a change in pull request #12374: Fix/public internal
header
URL: https://github.com/apache/incubator-mxnet/pull/12374#discussion_r217114907
##########
File path: include/mxnet/random_generator.h
##########
@@ -150,14 +149,9 @@ class RandGenerator<gpu, DType> {
curandStatePhilox4_32_10_t state_;
}; // class RandGenerator<gpu, DType>::Impl
- static void AllocState(RandGenerator<gpu, DType> *inst) {
- CUDA_CALL(cudaMalloc(&inst->states_,
- kNumRandomStates *
sizeof(curandStatePhilox4_32_10_t)));
- }
+ static void AllocState(RandGenerator<gpu, DType> *inst);
Review comment:
I suppose the developers did not intend to directly access internal Impl
class but was rather lacking proper interface API. In fact, throughout the
repository, I only found one place that uses `RandGenerator<cpu,` GType>::Impl`
directly, and therefore I think it's not a big overhead to refactor that one
line of code. Regarding how to separating Impl class from the interface, you
might find this reference helpful: https://cpppatterns.com/patterns/pimpl.html
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services