xtensor-stack / xtensor-blas

BLAS extension to xtensor
BSD 3-Clause "New" or "Revised" License
157 stars 55 forks source link

dot product with xtensor_fixed won't compile #186

Open Binary-Song opened 3 years ago

Binary-Song commented 3 years ago

Hello. I tried calling linalg::dot on xtensor_fixed objects, but it wouldn't compile (with Visual Studio 2019).

    xt::xtensor_fixed<double, xt::xshape<2, 3>> x;
    xt::xtensor_fixed<double, xt::xshape<3, 2>> y;
    x.fill(1);
    y.fill(2);
    xt::linalg::dot(x, y); 

The static assertion failed inside the dot function:

[build] C:\Program Files\xtensor\include\xtensor\xshape.hpp(317,57): error C2338: broadcast shapes do not match. [D:\Projects\CppDL\build\CppDL\NeuralNetwork\UT_NeuralNetworkTest.vcxproj]
[build] C:\Program Files\xtensor\include\xtensor\xshape.hpp(328): message : 查看对正在编译的 类 模板 实例化“xt::detail::broadcast_fixed_shape_cmp_impl<0,xt::fixed_shape<2,3>,xt::fixed_shape<3,2>>”的引用 [D:\Projects\CppDL\build\CppDL\NeuralNetwork\UT_NeuralNetworkTest.vcxproj]
[build] C:\Program Files\xtensor\include\xtensor\xshape.hpp(340): message : 查看对正在编译的 类 模板 实例化“xt::detail::broadcast_fixed_shape_impl<std::integer_sequence<size_t,0,1>,xt::fixed_shape<2,3>,xt::fixed_shape<3,2>>”的引用 [D:\Projects\CppDL\build\CppDL\NeuralNetwork\UT_NeuralNetworkTest.vcxproj]
[build] C:\Program Files\xtensor\include\xtensor\xshape.hpp(438): message : 查看对正在编译的 类 模板 实例化“xt::detail::broadcast_fixed_shape<xt::fixed_shape<2,3>,xt::fixed_shape<3,2>>”的引用 [D:\Projects\CppDL\build\CppDL\NeuralNetwork\UT_NeuralNetworkTest.vcxproj]
[build] C:\Program Files\xtensor\include\xtensor\xshape.hpp(450): message : 查看对正在编译的 类 模板 实例化“xt::detail::promote_fixed<xt::fixed_shape<2,3>,xt::fixed_shape<3,2>>”的引用 [D:\Projects\CppDL\build\CppDL\NeuralNetwork\UT_NeuralNetworkTest.vcxproj]
[build] C:\Program Files\xtensor\include\xtensor\xshape.hpp(469): message : 查看对正在编译的 类 模板 实例化“xt::detail::select_promote_index<true,true,xt::fixed_shape<2,3>,xt::fixed_shape<3,2>>”的引用 [D:\Projects\CppDL\build\CppDL\NeuralNetwork\UT_NeuralNetworkTest.vcxproj]
[build] C:\Program Files\xtensor\include\xtensor\xshape.hpp(487): message : 查看对正在编译的 类 模板 实例化“xt::detail::promote_index<xt::fixed_shape<2,3>,xt::fixed_shape<3,2>>”的引用 [D:\Projects\CppDL\build\CppDL\NeuralNetwork\UT_NeuralNetworkTest.vcxproj]
[build] C:\Program Files\xtensor\include\xtensor\xfunction.hpp(136): message : 查看对正在编译的 类 模板 实例化“xt::promote_shape<xt::fixed_shape<2,3>,xt::fixed_shape<3,2>>”的引用 [D:\Projects\CppDL\build\CppDL\NeuralNetwork\UT_NeuralNetworkTest.vcxproj]
[build] C:\Program Files\xtensor\include\xtensor\xfunction.hpp(136): message : 查看对正在编译的 别名 模板 实例化“xt::promote_shape_t<xt::fixed_shape<2,3>,xt::fixed_shape<3,2>>”的引用 [D:\Projects\CppDL\build\CppDL\NeuralNetwork\UT_NeuralNetworkTest.vcxproj]
[build] C:\Program Files\xtensor\include\xtensor\xiterable.hpp(43): message : 查看对正在编译的 类 模板 实例化“xt::xiterable_inner_types<D>”的引用 [D:\Projects\CppDL\build\CppDL\NeuralNetwork\UT_NeuralNetworkTest.vcxproj]
[build]           with
[build]           [
[build]               D=xt::xfunction<xt::detail::multiplies,const xt::xfixed_container<double,xt::fixed_shape<2,3>,xt::layout_type::row_major,true,xt::xtensor_expression_tag> &,const xt::xfixed_container<double,xt::fixed_shape<3,2>,xt::layout_type::row_major,true,xt::xtensor_expression_tag> &>
[build]           ]
[build] C:\Program Files\xtensor\include\xtensor\xfunction.hpp(178): message : 查看对正在编译的 类 模板 实例化“xt::xconst_iterable<xt::xfunction<F,const xt::xfixed_container<double,xt::fixed_shape<2,3>,xt::layout_type::row_major,true,xt::xtensor_expression_tag> &,const xt::xfixed_container<double,xt::fixed_shape<3,2>,xt::layout_type::row_major,true,xt::xtensor_expression_tag> &>>”的引用 [D:\Projects\CppDL\build\CppDL\NeuralNetwork\UT_NeuralNetworkTest.vcxproj]
[build]           with
[build]           [
[build]               F=xt::detail::multiplies
[build]           ]
[build] C:\Program Files\xtensor-blas\include\xtensor-blas/xlinalg.hpp(687): message : 查看对正在编译的 类 模板 实例化“xt::xfunction<F,const xt::xfixed_container<double,xt::fixed_shape<2,3>,xt::layout_type::row_major,true,xt::xtensor_expression_tag> &,const xt::xfixed_container<double,xt::fixed_shape<3,2>,xt::layout_type::row_major,true,xt::xtensor_expression_tag> &>”的引用 [D:\Projects\CppDL\build\CppDL\NeuralNetwork\UT_NeuralNetworkTest.vcxproj]
[build]           with
[build]           [
[build]               F=xt::detail::multiplies
[build]           ]
[build] D:\Projects\CppDL\CppDL\NeuralNetwork\test\NeuralNetworkTest.cpp(11): message : 查看对正在编译的函数 模板 实例化“auto xt::linalg::dot<D,xt::xfixed_container<double,xt::fixed_shape<3,2>,xt::layout_type::row_major,true,xt::xtensor_expression_tag>>(const xt::xexpression<D> &,const xt::xexpression<xt::xfixed_container<double,xt::fixed_shape<3,2>,xt::layout_type::row_major,true,xt::xtensor_expression_tag>> &)”的引用 [D:\Projects\CppDL\build\CppDL\NeuralNetwork\UT_NeuralNetworkTest.vcxproj]
[build]           with
[build]           [
[build]               D=xt::xfixed_container<double,xt::fixed_shape<2,3>,xt::layout_type::row_major,true,xt::xtensor_expression_tag>
[build]           ]

I am using xtensor-blas-0.19.0. Is it a bug or am I missing something?