Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ C++;没有足够模板参数的函数调用_C++_Templates_Template Argument Deduction - Fatal编程技术网

C++ C++;没有足够模板参数的函数调用

C++ C++;没有足够模板参数的函数调用,c++,templates,template-argument-deduction,C++,Templates,Template Argument Deduction,当我查看时,函数被声明为接受4个模板参数,但在调用该函数时,只有2个参数被传递给模板。在本例中,单元格参数和io类型来自何处 template<template<typename,typename> class LayerT, template<typename,typename> class BidirLayerT, typename cell_params, typename io_type>

当我查看时,函数被声明为接受4个模板参数,但在调用该函数时,只有2个参数被传递给模板。在本例中,单元格参数和io类型来自何处

template<template<typename,typename> class LayerT, 
         template<typename,typename> class BidirLayerT, 
         typename cell_params, 
         typename io_type>
  std::tuple<io_type, Tensor, Tensor> _lstm_impl(
      const io_type& input,
      const std::vector<cell_params>& params, 
      const Tensor& hx, 
      const Tensor& cx,
      int64_t num_layers, 
      double dropout_p, 
      bool train, 
      bool bidirectional) {
    ...
}



auto results = _lstm_impl<FullLayer, FullBidirectionalLayer>(input, params, hx[0], hx[1], num_layers, dropout_p, train, bidirectional) 
模板
std::tuple _lstm_impl(
常量io_类型和输入,
常量标准::向量和参数,
常数张量和hx,
常数张量&cx,
int64_t num_层,
双退学,
布尔火车,
布尔(双向){
...
}
自动结果=_lstm_impl(输入,参数,hx[0],hx[1],层数,辍学,训练,双向)

最后两个参数显然是从函数参数推导出来的<代码> iOyType < /C> >从代码>输入> C++ > CyelyPARAMS/<代码>从代码> PARAMS//CUL>

当使用模板时,只应在不能推导或当您需要强制特定类型时才提供显式类型。@“柠檬”您从未见过“代码> STD::SWIFT < /COD>或:代码< >代码>或<代码> STD::MaMaGOION/COD>?我以前见过他们。