xtensor - `xshared_expression` 不能接受 xfunction xexpression

xtensor - `xshared_expression` cannot take in a xfunction xexpression

从 cpp 文件复制:

#include <iostream>
#include <xtensor/xarray.hpp>
#include <xtensor/xio.hpp>
#include <xtensor/xview.hpp>
#include <xtensor/xexpression.hpp>

using int8 = std::int8_t;

template <typename T>
void make_shared(T&& expr){
    auto expression = xt::make_xshared(std::move(expr));
}

int main(){
    xt::xarray<double> arr1 {1.0, 2.0, 3.0};
    xt::xarray<double> arr2 {5.0, 6.0, 7.0};

    make_shared(arr1); // works
    make_shared(std::move(arr1)); // also works
    make_shared(xt::eval(arr1+arr2)); // also works
    make_shared(arr1+arr2); // fails
}

错误好像是xshared_expression需要一个strides_type,一般的xfunctions没有这个属性:

    (idp3) ❯ g++ -std=c++17 -I/Users/ray_zhang/anaconda3/envs/idp3/include hmm.cpp
    In file included from hmm.cpp:2:
    In file included from /Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xarray.hpp:19:
    In file included from /Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xcontainer.hpp:23:
    In file included from /Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xmath.hpp:23:
    In file included from /Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xaccumulator.hpp:17:
    /Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xexpression.hpp:371:42: error: no type named 'strides_type' in 'xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double,
          std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double,
          std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &>'
            using strides_type = typename E::strides_type;
                                 ~~~~~~~~~~~~^~~~~~~~~~~~
/Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xexpression.hpp:503:16: note: in instantiation of template class 'xt::xshared_expression<xt::xfunction<xt::detail::plus<double>, double, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &> >'
      requested here
        return xshared_expression<E>(std::make_shared<E>(expr));
               ^
hmm.cpp:11:27: note: in instantiation of function template specialization 'xt::make_xshared<xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >,
      xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >,
      xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &> >' requested here
    auto expression = xt::make_xshared(std::move(expr));
                          ^
hmm.cpp:20:5: note: in instantiation of function template specialization 'make_shared<xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >,
      xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >,
      xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &> >' requested here
    make_shared(arr1+arr2); // fails
    ^
In file included from hmm.cpp:2:
In file included from /Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xarray.hpp:19:
In file included from /Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xcontainer.hpp:23:
In file included from /Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xmath.hpp:23:
In file included from /Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xaccumulator.hpp:17:
/Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xexpression.hpp:372:46: error: no type named 'backstrides_type' in 'xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double,
      std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double,
      std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &>'
        using backstrides_type = typename E::backstrides_type;
                                 ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xexpression.hpp:375:48: error: no type named 'inner_strides_type' in 'xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double,
      std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double,
      std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &>'
        using inner_strides_type = typename E::inner_strides_type;
                                   ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xexpression.hpp:376:52: error: no type named 'inner_backstrides_type' in 'xt::xfunction<xt::detail::plus<double>, double, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &>'
        using inner_backstrides_type = typename E::inner_backstrides_type;
                                       ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xexpression.hpp:409:32: error: no member named 'strides' in 'xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double,
      std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double,
      std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &>'
        XTENSOR_FORWARD_METHOD(strides);
        ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xexpression.hpp:324:39: note: expanded from macro 'XTENSOR_FORWARD_METHOD'
        -> decltype(std::declval<E>().name())  \
                    ~~~~~~~~~~~~~~~~~ ^
/Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xexpression.hpp:411:32: error: no member named 'data' in 'xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double,
      std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double,
      std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &>'
        XTENSOR_FORWARD_METHOD(data);
        ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xexpression.hpp:324:39: note: expanded from macro 'XTENSOR_FORWARD_METHOD'
        -> decltype(std::declval<E>().name())  \
                    ~~~~~~~~~~~~~~~~~ ^
/Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xexpression.hpp:413:32: error: no member named 'data_offset' in 'xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double,
      std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double,
      std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &>'
        XTENSOR_FORWARD_METHOD(data_offset);
        ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xexpression.hpp:324:39: note: expanded from macro 'XTENSOR_FORWARD_METHOD'
        -> decltype(std::declval<E>().name())  \
                    ~~~~~~~~~~~~~~~~~ ^
/Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xexpression.hpp:415:32: error: no member named 'storage' in 'xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double,
      std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double,
      std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &>'
        XTENSOR_FORWARD_METHOD(storage);
        ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xexpression.hpp:324:39: note: expanded from macro 'XTENSOR_FORWARD_METHOD'
        -> decltype(std::declval<E>().name())  \
                    ~~~~~~~~~~~~~~~~~ ^
In file included from hmm.cpp:1:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/iostream:38:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/ios:216:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/__locale:15:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/string:470:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/string_view:169:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/__string:56:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/algorithm:643:
/Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2057:9: error: no matching constructor for initialization of 'xt::xfunction<xt::detail::plus<double>, double, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &>'
      : __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {}
        ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2159:9: note: in instantiation of function template specialization 'std::__1::__compressed_pair_elem<xt::xfunction<xt::detail::plus<double>, double, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &>, 1,
      false>::__compressed_pair_elem<xt::xexpression<xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major,
      xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major,
      xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &> > &, 0>' requested here
        _Base2(__pc, _VSTD::move(__second_args),
        ^
/Library/Developer/CommandLineTools/usr/include/c++/v1/memory:3572:16: note: in instantiation of function template specialization
      'std::__1::__compressed_pair<std::__1::allocator<xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major,
      xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major,
      xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &> >, xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double,
      std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double,
      std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &>
      >::__compressed_pair<std::__1::allocator<xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major,
      xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major,
      xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &> > &, xt::xexpression<xt::xfunction<xt::detail::plus<double>, double, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &> > &>'
      requested here
            :  __data_(piecewise_construct, _VSTD::forward_as_tuple(__a),
               ^
/Library/Developer/CommandLineTools/usr/include/c++/v1/memory:4230:26: note: in instantiation of function template specialization 'std::__1::__shared_ptr_emplace<xt::xfunction<xt::detail::plus<double>, double, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &>,
      std::__1::allocator<xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4,
      std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4,
      std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &> > >::__shared_ptr_emplace<xt::xexpression<xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double,
      std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double,
      std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &> > &>' requested here
    ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...);
                         ^
/Library/Developer/CommandLineTools/usr/include/c++/v1/memory:4600:29: note: in instantiation of function template specialization 'std::__1::shared_ptr<xt::xfunction<xt::detail::plus<double>, double, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &>
      >::make_shared<xt::xexpression<xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long,
      4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long,
      4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &> > &>' requested here
    return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);
                            ^
/Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xexpression.hpp:503:43: note: in instantiation of function template specialization 'std::__1::make_shared<xt::xfunction<xt::detail::plus<double>, double, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &>,
      xt::xexpression<xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4,
      std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4,
      std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &> > &>' requested here
        return xshared_expression<E>(std::make_shared<E>(expr));
                                          ^
hmm.cpp:20:5: note: in instantiation of function template specialization 'make_shared<xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >,
      xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >,
      xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &> >' requested here
    make_shared(arr1+arr2); // fails
    ^
/Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xfunction.hpp:557:9: note: candidate constructor not viable: no known conversion from 'xt::xexpression<xt::xfunction<xt::detail::plus<double>, double, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &> >' to
      'const xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4,
      std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4,
      std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &>' for 1st argument
        xfunction(const xfunction&) = default;
        ^
/Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xfunction.hpp:560:9: note: candidate constructor not viable: no known conversion from 'xt::xexpression<xt::xfunction<xt::detail::plus<double>, double, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const
      xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4, std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &> >' to
      'xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4,
      std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4,
      std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &>' for 1st argument
        xfunction(xfunction&&) = default;
        ^
/Users/ray_zhang/anaconda3/envs/idp3/include/xtensor/xfunction.hpp:553:9: note: candidate template ignored: requirement '!std::is_base_of<std::decay_t<xexpression<xfunction<plus<double>, double, const
      xarray_container<uvector<double, allocator<double> >, xt::layout_type::row_major, svector<unsigned long, 4, allocator<unsigned long>, true>, xtensor_expression_tag> &, const xarray_container<uvector<double,
      allocator<double> >, xt::layout_type::row_major, svector<unsigned long, 4, allocator<unsigned long>, true>, xtensor_expression_tag> &> > &>, self_type>::value' was not satisfied [with Func =
      xt::xexpression<xt::xfunction<xt::detail::plus<double>, double, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4,
      std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &, const xt::xarray_container<xt::uvector<double, std::__1::allocator<double> >, xt::layout_type::row_major, xt::svector<unsigned long, 4,
      std::__1::allocator<unsigned long>, true>, xt::xtensor_expression_tag> &> > &, CTA = <>]
        xfunction(Func&& f, CTA&&... e) noexcept;
        ^
9 errors generated.

我们如何将 xfunctions 传递给 xshared_expressions

这已在 xtensor 0.17.0 中修复