Fix a bunch of ODR violations.

This commit is contained in:
Antonio Sánchez
2024-01-30 22:38:43 +00:00
parent 7fd7a3f946
commit a9ddab3e06
5 changed files with 22 additions and 55 deletions

View File

@@ -1007,13 +1007,14 @@ class TensorBase<Derived, ReadOnlyAccessors>
#include EIGEN_READONLY_TENSORBASE_PLUGIN
#endif
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const Derived& derived() const { return *static_cast<const Derived*>(this); }
protected:
template <typename Scalar, int NumIndices, int Options, typename IndexType> friend class Tensor;
template <typename Scalar, typename Dimensions, int Option, typename IndexTypes> friend class TensorFixedSize;
// the Eigen:: prefix is required to workaround a compilation issue with nvcc 9.0
template <typename OtherDerived, int AccessLevel> friend class Eigen::TensorBase;
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const Derived& derived() const { return *static_cast<const Derived*>(this); }
};
template<typename Derived, int AccessLevel = internal::accessors_level<Derived>::value>
@@ -1199,6 +1200,11 @@ class TensorBase : public TensorBase<Derived, ReadOnlyAccessors> {
return TensorAsyncDevice<Derived, DeviceType, DoneCallback>(dev, derived(), std::move(done));
}
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE Derived& derived() { return *static_cast<Derived*>(this); }
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const Derived& derived() const { return *static_cast<const Derived*>(this); }
#ifdef EIGEN_TENSORBASE_PLUGIN
#include EIGEN_TENSORBASE_PLUGIN
#endif
@@ -1215,10 +1221,6 @@ class TensorBase : public TensorBase<Derived, ReadOnlyAccessors> {
internal::TensorExecutor<const Assign, DefaultDevice>::run(assign, DefaultDevice());
return derived();
}
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE Derived& derived() { return *static_cast<Derived*>(this); }
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const Derived& derived() const { return *static_cast<const Derived*>(this); }
};
#endif // EIGEN_PARSED_BY_DOXYGEN
} // end namespace Eigen

View File

@@ -23,9 +23,12 @@ namespace Eigen {
template <typename ADerived, typename BDerived, typename XDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorCwiseTernaryOp<internal::scalar_betainc_op<typename XDerived::Scalar>,
const ADerived, const BDerived, const XDerived>
betainc(const ADerived& a, const BDerived& b, const XDerived& x) {
betainc(const Eigen::TensorBase<ADerived, ReadOnlyAccessors>& a,
const Eigen::TensorBase<BDerived, ReadOnlyAccessors>& b,
const Eigen::TensorBase<XDerived, ReadOnlyAccessors>& x) {
return TensorCwiseTernaryOp<internal::scalar_betainc_op<typename XDerived::Scalar>, const ADerived, const BDerived,
const XDerived>(a, b, x, internal::scalar_betainc_op<typename XDerived::Scalar>());
const XDerived>(a.derived(), b.derived(), x.derived(),
internal::scalar_betainc_op<typename XDerived::Scalar>());
}
} // end namespace Eigen