xtensor-stack / xtensor

C++ tensors with broadcasting and lazy computing
BSD 3-Clause "New" or "Revised" License
3.33k stars 398 forks source link

There is not strides() for view of view ? #2544

Open zhangshaos opened 2 years ago

zhangshaos commented 2 years ago

Hi, description as the above title. My codes are:

xarray<double> ab = { 
{ 0.                 ,  1.                 ,  0.                 , -0.13412199999999999},
{-0.28172107246038075,  0.                 ,  0.9594963456583735 ,  0.381612172643986  },
{-0.                 ,  0.99999999999999989,  0.                 , -0.13412199999999996},
{-0.28123252272438348,  0.                 , -0.95963965537178542,  0.38160390121303717}
};
auto v1 = xt::view(ab, xt::keep(1,2,3), xt::all());
auto v2 = xt::view(v1, xt::all(), 0i64);
auto sorted_ab = xt::sort(v2);

Compile result:

C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe  /nologo /TP -DFMT_LOCALE -DFMT_SHARED -IE:\git_repos\vcpkg\installed\x64-windows\include /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MD /O2 /Ob2 /DNDEBUG /utf-8 /MP -std:c++17 /showIncludes /FoCMakeFiles\graph_ops.dir\graph_ops.cpp.obj /FdCMakeFiles\graph_ops.dir\ /FS -c ..\..\..\graph_ops.cpp

E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(147): error C2672: “xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<T>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>::strides”: 未找到匹配的重载函数 (not found matched overloaded function)
          with
          [
              T=double
          ]

...

  ..\..\..\graph_ops.cpp(550): note: 查看对正在编译的函数 模板 实例化 (look at compiling function template instance) “R xt::sort<D>(const xt::xexpression<D> &,ptrdiff_t)”的引用 (\'s reference)
          with
          [
              R=eval_type,
              D=xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<double>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<size_t>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>
          ]
E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(147): error C2893: 未能使函数模板 (can not make function template) “enable_if<xt::has_data_interface<T,void>::value&&is_strided_view,const xt::svector<ptrdiff_t,4,std::allocator<T>,true>&>::type xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<double>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<T>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>::strides(void) const”专用化 (specialized)
          with
          [
              T=ptrdiff_t
          ]
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor/xview.hpp(572): note: 参见 (see) “xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<T>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>::strides”的声明 (\'s declare)
          with
          [
              T=double
          ]
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(147): note: 用下列模板参数 (use following template arguments):
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(147): note: “T=xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<T>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>>”
E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(147): error C2672: “resize_container”: 未找到匹配的重载函数 (not found matched overloaded function)
E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(147): error C2780: “bool xt::resize_container(xt::fixed_shape<I...> &,size_t)”: 应输入 2 个参数,却提供了 1 个 (should input two arguments, but only one found)
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xutils.hpp(76): note: 参见 (see) “xt::resize_container”的声明 (\'s declare)
E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(147): error C2780: “bool xt::resize_container(std::array<_Ty,_Size> &,std::array<_Ty,_Size>::size_type)”: 应输入 2 个参数,却提供了 1 个 (should input two arguments, but only one found)
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xutils.hpp(70): note: 参见 (see) “xt::resize_container”的声明 (\'s declare)
E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(147): error C2780: “bool xt::resize_container(C &,C::size_type)”: 应输入 2 个参数,却提供了 1 个 (should input two arguments, but only one found)
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xutils.hpp(67): note: 参见 (see) “xt::resize_container”的声明 (\'s declare)
E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(158): error C2672: “xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<T>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>::strides”: 未找到匹配的重载函数 (not found matched overloaded function)
          with
          [
              T=double
          ]
E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(158): error C2893: 未能使函数模板 (can not make funcion template) “enable_if<xt::has_data_interface<T,void>::value&&is_strided_view,const xt::svector<ptrdiff_t,4,std::allocator<T>,true>&>::type xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<double>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<T>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>::strides(void) const”专用化 (specialized)
          with
          [
              T=ptrdiff_t
          ]
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor/xview.hpp(572): note: 参见 (see) “xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<T>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>::strides”的声明 (\'s declare)
          with
          [
              T=double
          ]
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(158): note: 用下列模板参数 (use following template arguments):
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(158): note: “T=xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<T>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>>”
  ninja: build stopped: subcommand failed.

全部生成 失败。

Environment:

zhangshaos commented 2 years ago

Here are the total compile results, but in Chinese:

>------ 全部生成 已启动: 项目: graph_ops,配置: x64-Debug ------
  [1/2] Building CXX object CMakeFiles\graph_ops.dir\graph_ops.cpp.obj
  FAILED: CMakeFiles/graph_ops.dir/graph_ops.cpp.obj 
  C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe  /nologo /TP -DFMT_LOCALE -DFMT_SHARED -IE:\git_repos\vcpkg\installed\x64-windows\include /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MD /O2 /Ob2 /DNDEBUG /utf-8 /MP -std:c++17 /showIncludes /FoCMakeFiles\graph_ops.dir\graph_ops.cpp.obj /FdCMakeFiles\graph_ops.dir\ /FS -c ..\..\..\graph_ops.cpp
E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(147): error C2672: “xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<T>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>::strides”: 未找到匹配的重载函数
          with
          [
              T=double
          ]
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(240): note: 查看对正在编译的函数 模板 实例化“auto xt::detail::transpose_impl<const E&,xt::svector<size_t,4,std::allocator<T>,true>&>(const xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<double>>,xt::layout_type::row_major,xt::svector<T,4,std::allocator<T>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<T>> &,xt::xall<T>,__int64>&,S,xt::check_policy::none)”的引用
          with
          [
              E=xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<double>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<size_t>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>,
              T=size_t,
              S=xt::svector<size_t,4,std::allocator<size_t>,true> &
          ]
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor/xsort.hpp(112): note: 查看对正在编译的函数 模板 实例化“auto xt::transpose<const E&,xt::svector<size_t,4,std::allocator<T>,true>&,xt::check_policy::none>(const xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<double>>,xt::layout_type::row_major,xt::svector<T,4,std::allocator<T>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<T>> &,xt::xall<T>,__int64>&,S,Tag)”的引用
          with
          [
              E=xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<double>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<size_t>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>,
              T=size_t,
              S=xt::svector<size_t,4,std::allocator<size_t>,true> &,
              Tag=xt::check_policy::none
          ]
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor/xsort.hpp(210): note: 查看对正在编译的函数 模板 实例化“auto xt::detail::run_lambda_over_axis<xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<T>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>,eval_type,xt::sort::<lambda_8b138a2765a42d91b182faef8a41cca6>>(const E &,R &,size_t,F &&)”的引用
          with
          [
              T=double,
              E=xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<double>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<size_t>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>,
              R=eval_type,
              F=xt::sort::<lambda_8b138a2765a42d91b182faef8a41cca6>
          ]
  ..\..\..\graph_ops.cpp(550): note: 查看对正在编译的函数 模板 实例化“R xt::sort<D>(const xt::xexpression<D> &,ptrdiff_t)”的引用
          with
          [
              R=eval_type,
              D=xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<double>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<size_t>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>
          ]
E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(147): error C2893: 未能使函数模板“enable_if<xt::has_data_interface<T,void>::value&&is_strided_view,const xt::svector<ptrdiff_t,4,std::allocator<T>,true>&>::type xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<double>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<T>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>::strides(void) const”专用化
          with
          [
              T=ptrdiff_t
          ]
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor/xview.hpp(572): note: 参见“xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<T>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>::strides”的声明
          with
          [
              T=double
          ]
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(147): note: 用下列模板参数:
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(147): note: “T=xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<T>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>>”
E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(147): error C2672: “resize_container”: 未找到匹配的重载函数
E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(147): error C2780: “bool xt::resize_container(xt::fixed_shape<I...> &,size_t)”: 应输入 2 个参数,却提供了 1 个
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xutils.hpp(76): note: 参见“xt::resize_container”的声明
E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(147): error C2780: “bool xt::resize_container(std::array<_Ty,_Size> &,std::array<_Ty,_Size>::size_type)”: 应输入 2 个参数,却提供了 1 个
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xutils.hpp(70): note: 参见“xt::resize_container”的声明
E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(147): error C2780: “bool xt::resize_container(C &,C::size_type)”: 应输入 2 个参数,却提供了 1 个
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xutils.hpp(67): note: 参见“xt::resize_container”的声明
E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(158): error C2672: “xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<T>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>::strides”: 未找到匹配的重载函数
          with
          [
              T=double
          ]
E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(158): error C2893: 未能使函数模板“enable_if<xt::has_data_interface<T,void>::value&&is_strided_view,const xt::svector<ptrdiff_t,4,std::allocator<T>,true>&>::type xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<double>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<T>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>::strides(void) const”专用化
          with
          [
              T=ptrdiff_t
          ]
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor/xview.hpp(572): note: 参见“xt::xview<xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<T>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>> &,xt::xall<unsigned __int64>,__int64>::strides”的声明
          with
          [
              T=double
          ]
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(158): note: 用下列模板参数:
  E:\git_repos\vcpkg\installed\x64-windows\include\xtensor\xmanipulation.hpp(158): note: “T=xt::xview<xt::xarray_container<xt::uvector<double,std::allocator<T>>,xt::layout_type::row_major,xt::svector<size_t,4,std::allocator<unsigned __int64>,true>,xt::xtensor_expression_tag> &,xt::xkeep_slice<ptrdiff_t>,xt::xall<unsigned __int64>>”
  ninja: build stopped: subcommand failed.

全部生成 失败。