mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Merge with upstream
This commit is contained in:
commit
8ba799805b
@ -66,6 +66,7 @@ namespace Eigen
|
|||||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sinh,scalar_sinh_op,hyperbolic sine,\sa ArrayBase::sinh)
|
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sinh,scalar_sinh_op,hyperbolic sine,\sa ArrayBase::sinh)
|
||||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cosh,scalar_cosh_op,hyperbolic cosine,\sa ArrayBase::cosh)
|
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cosh,scalar_cosh_op,hyperbolic cosine,\sa ArrayBase::cosh)
|
||||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(tanh,scalar_tanh_op,hyperbolic tangent,\sa ArrayBase::tanh)
|
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(tanh,scalar_tanh_op,hyperbolic tangent,\sa ArrayBase::tanh)
|
||||||
|
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(logistic,scalar_logistic_op,logistic function,\sa ArrayBase::logistic)
|
||||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(lgamma,scalar_lgamma_op,natural logarithm of the gamma function,\sa ArrayBase::lgamma)
|
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(lgamma,scalar_lgamma_op,natural logarithm of the gamma function,\sa ArrayBase::lgamma)
|
||||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(digamma,scalar_digamma_op,derivative of lgamma,\sa ArrayBase::digamma)
|
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(digamma,scalar_digamma_op,derivative of lgamma,\sa ArrayBase::digamma)
|
||||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(erf,scalar_erf_op,error function,\sa ArrayBase::erf)
|
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(erf,scalar_erf_op,error function,\sa ArrayBase::erf)
|
||||||
|
@ -823,6 +823,34 @@ struct functor_traits<scalar_sign_op<Scalar> >
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** \internal
|
||||||
|
* \brief Template functor to compute the logistic function of a scalar
|
||||||
|
* \sa class CwiseUnaryOp, ArrayBase::logistic()
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
struct scalar_logistic_op {
|
||||||
|
EIGEN_EMPTY_STRUCT_CTOR(scalar_logistic_op)
|
||||||
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T operator()(const T& x) const {
|
||||||
|
const T one = T(1);
|
||||||
|
return one / (one + numext::exp(-x));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||||
|
Packet packetOp(const Packet& x) const {
|
||||||
|
const Packet one = pset1<Packet>(T(1));
|
||||||
|
return pdiv(one, padd(one, pexp(pnegate(x))));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
template <typename T>
|
||||||
|
struct functor_traits<scalar_logistic_op<T> > {
|
||||||
|
enum {
|
||||||
|
Cost = NumTraits<T>::AddCost * 2 + NumTraits<T>::MulCost * 6,
|
||||||
|
PacketAccess = packet_traits<T>::HasAdd && packet_traits<T>::HasDiv &&
|
||||||
|
packet_traits<T>::HasNegate && packet_traits<T>::HasExp
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
} // end namespace internal
|
} // end namespace internal
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
@ -21,6 +21,7 @@ typedef CwiseUnaryOp<internal::scalar_acos_op<Scalar>, const Derived> AcosReturn
|
|||||||
typedef CwiseUnaryOp<internal::scalar_asin_op<Scalar>, const Derived> AsinReturnType;
|
typedef CwiseUnaryOp<internal::scalar_asin_op<Scalar>, const Derived> AsinReturnType;
|
||||||
typedef CwiseUnaryOp<internal::scalar_atan_op<Scalar>, const Derived> AtanReturnType;
|
typedef CwiseUnaryOp<internal::scalar_atan_op<Scalar>, const Derived> AtanReturnType;
|
||||||
typedef CwiseUnaryOp<internal::scalar_tanh_op<Scalar>, const Derived> TanhReturnType;
|
typedef CwiseUnaryOp<internal::scalar_tanh_op<Scalar>, const Derived> TanhReturnType;
|
||||||
|
typedef CwiseUnaryOp<internal::scalar_logistic_op<Scalar>, const Derived> LogisticReturnType;
|
||||||
typedef CwiseUnaryOp<internal::scalar_sinh_op<Scalar>, const Derived> SinhReturnType;
|
typedef CwiseUnaryOp<internal::scalar_sinh_op<Scalar>, const Derived> SinhReturnType;
|
||||||
typedef CwiseUnaryOp<internal::scalar_cosh_op<Scalar>, const Derived> CoshReturnType;
|
typedef CwiseUnaryOp<internal::scalar_cosh_op<Scalar>, const Derived> CoshReturnType;
|
||||||
typedef CwiseUnaryOp<internal::scalar_square_op<Scalar>, const Derived> SquareReturnType;
|
typedef CwiseUnaryOp<internal::scalar_square_op<Scalar>, const Derived> SquareReturnType;
|
||||||
@ -335,6 +336,15 @@ cosh() const
|
|||||||
return CoshReturnType(derived());
|
return CoshReturnType(derived());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** \returns an expression of the coefficient-wise logistic of *this.
|
||||||
|
*/
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
|
inline const LogisticReturnType
|
||||||
|
logistic() const
|
||||||
|
{
|
||||||
|
return LogisticReturnType(derived());
|
||||||
|
}
|
||||||
|
|
||||||
/** \returns an expression of the coefficient-wise inverse of *this.
|
/** \returns an expression of the coefficient-wise inverse of *this.
|
||||||
*
|
*
|
||||||
* Example: \include Cwise_inverse.cpp
|
* Example: \include Cwise_inverse.cpp
|
||||||
|
@ -231,6 +231,7 @@ template<typename ArrayType> void array_real(const ArrayType& m)
|
|||||||
VERIFY_IS_APPROX(m1.sinh(), sinh(m1));
|
VERIFY_IS_APPROX(m1.sinh(), sinh(m1));
|
||||||
VERIFY_IS_APPROX(m1.cosh(), cosh(m1));
|
VERIFY_IS_APPROX(m1.cosh(), cosh(m1));
|
||||||
VERIFY_IS_APPROX(m1.tanh(), tanh(m1));
|
VERIFY_IS_APPROX(m1.tanh(), tanh(m1));
|
||||||
|
VERIFY_IS_APPROX(m1.logistic(), logistic(m1));
|
||||||
|
|
||||||
VERIFY_IS_APPROX(m1.arg(), arg(m1));
|
VERIFY_IS_APPROX(m1.arg(), arg(m1));
|
||||||
VERIFY_IS_APPROX(m1.round(), round(m1));
|
VERIFY_IS_APPROX(m1.round(), round(m1));
|
||||||
@ -266,6 +267,7 @@ template<typename ArrayType> void array_real(const ArrayType& m)
|
|||||||
VERIFY_IS_APPROX(sinh(m1), 0.5*(exp(m1)-exp(-m1)));
|
VERIFY_IS_APPROX(sinh(m1), 0.5*(exp(m1)-exp(-m1)));
|
||||||
VERIFY_IS_APPROX(cosh(m1), 0.5*(exp(m1)+exp(-m1)));
|
VERIFY_IS_APPROX(cosh(m1), 0.5*(exp(m1)+exp(-m1)));
|
||||||
VERIFY_IS_APPROX(tanh(m1), (0.5*(exp(m1)-exp(-m1)))/(0.5*(exp(m1)+exp(-m1))));
|
VERIFY_IS_APPROX(tanh(m1), (0.5*(exp(m1)-exp(-m1)))/(0.5*(exp(m1)+exp(-m1))));
|
||||||
|
VERIFY_IS_APPROX(logistic(m1), (1.0/(1.0+exp(-m1))));
|
||||||
VERIFY_IS_APPROX(arg(m1), ((m1<0).template cast<Scalar>())*std::acos(-1.0));
|
VERIFY_IS_APPROX(arg(m1), ((m1<0).template cast<Scalar>())*std::acos(-1.0));
|
||||||
VERIFY((round(m1) <= ceil(m1) && round(m1) >= floor(m1)).all());
|
VERIFY((round(m1) <= ceil(m1) && round(m1) >= floor(m1)).all());
|
||||||
VERIFY((Eigen::isnan)((m1*0.0)/0.0).all());
|
VERIFY((Eigen::isnan)((m1*0.0)/0.0).all());
|
||||||
@ -345,6 +347,7 @@ template<typename ArrayType> void array_complex(const ArrayType& m)
|
|||||||
VERIFY_IS_APPROX(m1.sinh(), sinh(m1));
|
VERIFY_IS_APPROX(m1.sinh(), sinh(m1));
|
||||||
VERIFY_IS_APPROX(m1.cosh(), cosh(m1));
|
VERIFY_IS_APPROX(m1.cosh(), cosh(m1));
|
||||||
VERIFY_IS_APPROX(m1.tanh(), tanh(m1));
|
VERIFY_IS_APPROX(m1.tanh(), tanh(m1));
|
||||||
|
VERIFY_IS_APPROX(m1.logistic(), logistic(m1));
|
||||||
VERIFY_IS_APPROX(m1.arg(), arg(m1));
|
VERIFY_IS_APPROX(m1.arg(), arg(m1));
|
||||||
VERIFY((m1.isNaN() == (Eigen::isnan)(m1)).all());
|
VERIFY((m1.isNaN() == (Eigen::isnan)(m1)).all());
|
||||||
VERIFY((m1.isInf() == (Eigen::isinf)(m1)).all());
|
VERIFY((m1.isInf() == (Eigen::isinf)(m1)).all());
|
||||||
@ -368,6 +371,7 @@ template<typename ArrayType> void array_complex(const ArrayType& m)
|
|||||||
VERIFY_IS_APPROX(sinh(m1), 0.5*(exp(m1)-exp(-m1)));
|
VERIFY_IS_APPROX(sinh(m1), 0.5*(exp(m1)-exp(-m1)));
|
||||||
VERIFY_IS_APPROX(cosh(m1), 0.5*(exp(m1)+exp(-m1)));
|
VERIFY_IS_APPROX(cosh(m1), 0.5*(exp(m1)+exp(-m1)));
|
||||||
VERIFY_IS_APPROX(tanh(m1), (0.5*(exp(m1)-exp(-m1)))/(0.5*(exp(m1)+exp(-m1))));
|
VERIFY_IS_APPROX(tanh(m1), (0.5*(exp(m1)-exp(-m1)))/(0.5*(exp(m1)+exp(-m1))));
|
||||||
|
VERIFY_IS_APPROX(logistic(m1), (1.0/(1.0 + exp(-m1))));
|
||||||
|
|
||||||
for (Index i = 0; i < m.rows(); ++i)
|
for (Index i = 0; i < m.rows(); ++i)
|
||||||
for (Index j = 0; j < m.cols(); ++j)
|
for (Index j = 0; j < m.cols(); ++j)
|
||||||
|
@ -187,7 +187,7 @@ struct TensorEvaluator<const TensorAssignOp<LeftArgType, RightArgType>, Device>
|
|||||||
|
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalBlock(TensorBlock* block) {
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalBlock(TensorBlock* block) {
|
||||||
if (TensorEvaluator<LeftArgType, Device>::RawAccess &&
|
if (TensorEvaluator<LeftArgType, Device>::RawAccess &&
|
||||||
m_leftImpl.data() != nullptr) {
|
m_leftImpl.data() != NULL) {
|
||||||
TensorBlock left_block(block->first_coeff_index(), block->block_sizes(),
|
TensorBlock left_block(block->first_coeff_index(), block->block_sizes(),
|
||||||
block->tensor_strides(), block->tensor_strides(),
|
block->tensor_strides(), block->tensor_strides(),
|
||||||
m_leftImpl.data() + block->first_coeff_index());
|
m_leftImpl.data() + block->first_coeff_index());
|
||||||
|
@ -200,9 +200,9 @@ class TensorBase<Derived, ReadOnlyAccessors>
|
|||||||
}
|
}
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_sigmoid_op<Scalar>, const Derived>
|
EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_logistic_op<Scalar>, const Derived>
|
||||||
sigmoid() const {
|
sigmoid() const {
|
||||||
return unaryExpr(internal::scalar_sigmoid_op<Scalar>());
|
return unaryExpr(internal::scalar_logistic_op<Scalar>());
|
||||||
}
|
}
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
|
@ -155,8 +155,8 @@ struct TensorBlockCopyOp {
|
|||||||
typedef const Eigen::Array<Scalar, Dynamic, 1> Src;
|
typedef const Eigen::Array<Scalar, Dynamic, 1> Src;
|
||||||
typedef Eigen::Array<Scalar, Dynamic, 1> Dst;
|
typedef Eigen::Array<Scalar, Dynamic, 1> Dst;
|
||||||
|
|
||||||
typedef Eigen::Map<Src, 0, InnerStride<>> SrcMap;
|
typedef Eigen::Map<Src, 0, InnerStride<> > SrcMap;
|
||||||
typedef Eigen::Map<Dst, 0, InnerStride<>> DstMap;
|
typedef Eigen::Map<Dst, 0, InnerStride<> > DstMap;
|
||||||
|
|
||||||
const SrcMap src(src_base, num_coeff_to_copy, InnerStride<>(src_stride));
|
const SrcMap src(src_base, num_coeff_to_copy, InnerStride<>(src_stride));
|
||||||
DstMap dst(dst_base, num_coeff_to_copy, InnerStride<>(dst_stride));
|
DstMap dst(dst_base, num_coeff_to_copy, InnerStride<>(dst_stride));
|
||||||
@ -405,9 +405,9 @@ struct TensorBlockCwiseBinaryOp {
|
|||||||
typedef const Eigen::Array<RightScalar, Dynamic, 1> Rhs;
|
typedef const Eigen::Array<RightScalar, Dynamic, 1> Rhs;
|
||||||
typedef Eigen::Array<OutputScalar, Dynamic, 1> Out;
|
typedef Eigen::Array<OutputScalar, Dynamic, 1> Out;
|
||||||
|
|
||||||
typedef Eigen::Map<Lhs, 0, InnerStride<>> LhsMap;
|
typedef Eigen::Map<Lhs, 0, InnerStride<> > LhsMap;
|
||||||
typedef Eigen::Map<Rhs, 0, InnerStride<>> RhsMap;
|
typedef Eigen::Map<Rhs, 0, InnerStride<> > RhsMap;
|
||||||
typedef Eigen::Map<Out, 0, InnerStride<>> OutMap;
|
typedef Eigen::Map<Out, 0, InnerStride<> > OutMap;
|
||||||
|
|
||||||
const LeftScalar* lhs_base = &left_data[left_index];
|
const LeftScalar* lhs_base = &left_data[left_index];
|
||||||
const RightScalar* rhs_base = &right_data[right_index];
|
const RightScalar* rhs_base = &right_data[right_index];
|
||||||
@ -501,7 +501,7 @@ struct TensorBlockCwiseBinaryIO {
|
|||||||
if (size == 1) {
|
if (size == 1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
auto& state = block_iter_state[num_squeezed_dims];
|
BlockIteratorState& state = block_iter_state[num_squeezed_dims];
|
||||||
state.output_stride = block_strides[dim];
|
state.output_stride = block_strides[dim];
|
||||||
state.left_stride = left_strides[dim];
|
state.left_stride = left_strides[dim];
|
||||||
state.right_stride = right_strides[dim];
|
state.right_stride = right_strides[dim];
|
||||||
@ -523,7 +523,7 @@ struct TensorBlockCwiseBinaryIO {
|
|||||||
right_stride, right_data);
|
right_stride, right_data);
|
||||||
// Update index.
|
// Update index.
|
||||||
for (int j = 0; j < num_squeezed_dims; ++j) {
|
for (int j = 0; j < num_squeezed_dims; ++j) {
|
||||||
auto& state = block_iter_state[j];
|
BlockIteratorState& state = block_iter_state[j];
|
||||||
if (++state.count < state.size) {
|
if (++state.count < state.size) {
|
||||||
output_index += state.output_stride;
|
output_index += state.output_stride;
|
||||||
left_index += state.left_stride;
|
left_index += state.left_stride;
|
||||||
|
@ -102,7 +102,7 @@ class Allocator {
|
|||||||
// Build a thread pool device on top the an existing pool of threads.
|
// Build a thread pool device on top the an existing pool of threads.
|
||||||
struct ThreadPoolDevice {
|
struct ThreadPoolDevice {
|
||||||
// The ownership of the thread pool remains with the caller.
|
// The ownership of the thread pool remains with the caller.
|
||||||
ThreadPoolDevice(ThreadPoolInterface* pool, int num_cores, Allocator* allocator = nullptr)
|
ThreadPoolDevice(ThreadPoolInterface* pool, int num_cores, Allocator* allocator = NULL)
|
||||||
: pool_(pool), num_threads_(num_cores), allocator_(allocator) { }
|
: pool_(pool), num_threads_(num_cores), allocator_(allocator) { }
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE void* allocate(size_t num_bytes) const {
|
EIGEN_STRONG_INLINE void* allocate(size_t num_bytes) const {
|
||||||
@ -282,7 +282,7 @@ struct ThreadPoolDevice {
|
|||||||
// Convenience wrapper for parallelFor that does not align blocks.
|
// Convenience wrapper for parallelFor that does not align blocks.
|
||||||
void parallelFor(Index n, const TensorOpCost& cost,
|
void parallelFor(Index n, const TensorOpCost& cost,
|
||||||
std::function<void(Index, Index)> f) const {
|
std::function<void(Index, Index)> f) const {
|
||||||
parallelFor(n, cost, nullptr, std::move(f));
|
parallelFor(n, cost, NULL, std::move(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Thread pool accessor.
|
// Thread pool accessor.
|
||||||
|
@ -227,7 +227,7 @@ class TensorExecutor<Expression, ThreadPoolDevice, Vectorizable, Tileable> {
|
|||||||
typedef EvalRange<Evaluator, StorageIndex, Vectorizable> EvalRange;
|
typedef EvalRange<Evaluator, StorageIndex, Vectorizable> EvalRange;
|
||||||
|
|
||||||
Evaluator evaluator(expr, device);
|
Evaluator evaluator(expr, device);
|
||||||
const bool needs_assign = evaluator.evalSubExprsIfNeeded(nullptr);
|
const bool needs_assign = evaluator.evalSubExprsIfNeeded(NULL);
|
||||||
if (needs_assign) {
|
if (needs_assign) {
|
||||||
const StorageIndex PacketSize =
|
const StorageIndex PacketSize =
|
||||||
Vectorizable
|
Vectorizable
|
||||||
@ -257,7 +257,6 @@ class TensorExecutor<Expression, ThreadPoolDevice, Vectorizable, /*Tileable*/ tr
|
|||||||
|
|
||||||
static EIGEN_STRONG_INLINE void run(const Expression& expr,
|
static EIGEN_STRONG_INLINE void run(const Expression& expr,
|
||||||
const ThreadPoolDevice& device) {
|
const ThreadPoolDevice& device) {
|
||||||
typedef TensorBlock<ScalarNoConst, StorageIndex, NumDims, Evaluator::Layout> TensorBlock;
|
|
||||||
typedef TensorBlockMapper<ScalarNoConst, StorageIndex, NumDims, Evaluator::Layout> TensorBlockMapper;
|
typedef TensorBlockMapper<ScalarNoConst, StorageIndex, NumDims, Evaluator::Layout> TensorBlockMapper;
|
||||||
|
|
||||||
Evaluator evaluator(expr, device);
|
Evaluator evaluator(expr, device);
|
||||||
@ -271,7 +270,7 @@ class TensorExecutor<Expression, ThreadPoolDevice, Vectorizable, /*Tileable*/ tr
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool needs_assign = evaluator.evalSubExprsIfNeeded(nullptr);
|
const bool needs_assign = evaluator.evalSubExprsIfNeeded(NULL);
|
||||||
if (needs_assign) {
|
if (needs_assign) {
|
||||||
TensorBlockShapeType block_shape = TensorBlockShapeType::kSkewedInnerDims;
|
TensorBlockShapeType block_shape = TensorBlockShapeType::kSkewedInnerDims;
|
||||||
Index block_total_size = 0;
|
Index block_total_size = 0;
|
||||||
|
@ -54,36 +54,6 @@ struct functor_traits<scalar_fmod_op<Scalar> > {
|
|||||||
PacketAccess = false };
|
PacketAccess = false };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** \internal
|
|
||||||
* \brief Template functor to compute the sigmoid of a scalar
|
|
||||||
* \sa class CwiseUnaryOp, ArrayBase::sigmoid()
|
|
||||||
*/
|
|
||||||
template <typename T>
|
|
||||||
struct scalar_sigmoid_op {
|
|
||||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_sigmoid_op)
|
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T operator()(const T& x) const {
|
|
||||||
const T one = T(1);
|
|
||||||
return one / (one + numext::exp(-x));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
|
||||||
Packet packetOp(const Packet& x) const {
|
|
||||||
const Packet one = pset1<Packet>(T(1));
|
|
||||||
return pdiv(one, padd(one, pexp(pnegate(x))));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct functor_traits<scalar_sigmoid_op<T> > {
|
|
||||||
enum {
|
|
||||||
Cost = NumTraits<T>::AddCost * 2 + NumTraits<T>::MulCost * 6,
|
|
||||||
PacketAccess = packet_traits<T>::HasAdd && packet_traits<T>::HasDiv &&
|
|
||||||
packet_traits<T>::HasNegate && packet_traits<T>::HasExp
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<typename Reducer, typename Device>
|
template<typename Reducer, typename Device>
|
||||||
struct reducer_traits {
|
struct reducer_traits {
|
||||||
enum {
|
enum {
|
||||||
|
@ -428,7 +428,7 @@ void test_threadpool_allocate(TestAllocator* allocator)
|
|||||||
void* ptr = device.allocate(512);
|
void* ptr = device.allocate(512);
|
||||||
device.deallocate(ptr);
|
device.deallocate(ptr);
|
||||||
}
|
}
|
||||||
VERIFY(allocator != nullptr);
|
VERIFY(allocator != NULL);
|
||||||
VERIFY_IS_EQUAL(allocator->alloc_count(), num_allocs);
|
VERIFY_IS_EQUAL(allocator->alloc_count(), num_allocs);
|
||||||
VERIFY_IS_EQUAL(allocator->dealloc_count(), num_allocs);
|
VERIFY_IS_EQUAL(allocator->dealloc_count(), num_allocs);
|
||||||
}
|
}
|
||||||
@ -460,7 +460,7 @@ EIGEN_DECLARE_TEST(cxx11_tensor_thread_pool)
|
|||||||
CALL_SUBTEST_6(test_multithread_random());
|
CALL_SUBTEST_6(test_multithread_random());
|
||||||
|
|
||||||
TestAllocator test_allocator;
|
TestAllocator test_allocator;
|
||||||
CALL_SUBTEST_6(test_multithread_shuffle<ColMajor>(nullptr));
|
CALL_SUBTEST_6(test_multithread_shuffle<ColMajor>(NULL));
|
||||||
CALL_SUBTEST_6(test_multithread_shuffle<RowMajor>(&test_allocator));
|
CALL_SUBTEST_6(test_multithread_shuffle<RowMajor>(&test_allocator));
|
||||||
CALL_SUBTEST_6(test_threadpool_allocate(&test_allocator));
|
CALL_SUBTEST_6(test_threadpool_allocate(&test_allocator));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user