Rewrote the TensorBase::random method to support the generation of random number on gpu.

This commit is contained in:
Benoit Steiner 2014-10-09 15:39:13 -07:00
parent 767424af18
commit 498b7eed25

View File

@ -39,9 +39,14 @@ class TensorBase<Derived, ReadOnlyAccessors>
}
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const TensorCwiseNullaryOp<internal::scalar_random_op<Scalar>, const Derived>
EIGEN_STRONG_INLINE const TensorCwiseNullaryOp<internal::UniformRandomGenerator<Scalar>, const Derived>
random() const {
return TensorCwiseNullaryOp<internal::scalar_random_op<Scalar>, const Derived>(derived());
return TensorCwiseNullaryOp<internal::UniformRandomGenerator<Scalar>, const Derived>(derived());
}
template <typename RandomGenerator> EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const TensorCwiseNullaryOp<RandomGenerator, const Derived>
random() const {
return TensorCwiseNullaryOp<RandomGenerator, const Derived>(derived());
}
// Coefficient-wise unary operators