|
|
|
@ -137,7 +137,6 @@ void TensorCopySync(const Tensor& src, const platform::Place& dst_place,
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
template <typename Predicate, typename DevCtx>
|
|
|
|
|
struct AnyDTypeVisitor {
|
|
|
|
|
Predicate predicate_;
|
|
|
|
@ -150,11 +149,7 @@ struct AnyDTypeVisitor {
|
|
|
|
|
: predicate_(predicate), tensor_(tensor), ctx_(ctx), out_(out) {}
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
void apply()() const {
|
|
|
|
|
=======
|
|
|
|
|
void apply() const {
|
|
|
|
|
>>>>>>> origin/develop
|
|
|
|
|
auto t = EigenVector<T>::Flatten(tensor_);
|
|
|
|
|
auto o = EigenScalar<bool>::From(*out_);
|
|
|
|
|
// return any of predicate_(t) is true.
|
|
|
|
@ -178,7 +173,7 @@ struct AnyVisitor : public boost::static_visitor<bool> {
|
|
|
|
|
: tensor_(tensor), predicate_(std::move(predicate)) {}
|
|
|
|
|
|
|
|
|
|
template <typename Place>
|
|
|
|
|
bool apply()(const Place& place) const {
|
|
|
|
|
bool operator()(const Place& place) const {
|
|
|
|
|
framework::Tensor out;
|
|
|
|
|
out.Resize({1});
|
|
|
|
|
out.mutable_data<bool>(place);
|
|
|
|
@ -245,7 +240,6 @@ bool TensorContainsInf(const framework::Tensor& tensor) {
|
|
|
|
|
ContainsInfPredicate predicate;
|
|
|
|
|
return Any(tensor, predicate);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
void TensorToStream(std::ostream& os, const Tensor& tensor,
|
|
|
|
|
const platform::DeviceContext& dev_ctx) {
|
|
|
|
|