mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix boolean scatter and random generation for tensors.
This commit is contained in:
@@ -49,6 +49,12 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T RandomToTypeUniform(uint64_t* state, uin
|
||||
return static_cast<T>(rnd);
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool RandomToTypeUniform<bool>(uint64_t* state, uint64_t stream) {
|
||||
unsigned rnd = PCG_XSH_RS_generator(state, stream);
|
||||
return (rnd & 0x1) != 0;
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Eigen::half RandomToTypeUniform<Eigen::half>(uint64_t* state, uint64_t stream) {
|
||||
// Generate 10 random bits for the mantissa, merge with exponent.
|
||||
|
||||
Reference in New Issue
Block a user