提交 d53b38e3 编写于 作者: Y Yu Yang

Follow comments, change KT to KERNEL_TYPE

上级 87da1542
...@@ -103,18 +103,19 @@ class OpRegistrar : public Registrar { ...@@ -103,18 +103,19 @@ class OpRegistrar : public Registrar {
template <typename PlaceType, bool at_end, size_t I, typename... KernelType> template <typename PlaceType, bool at_end, size_t I, typename... KernelType>
struct OpKernelRegistrarFunctor; struct OpKernelRegistrarFunctor;
template <typename PlaceType, size_t I, typename... KernelType> template <typename PlaceType, size_t I, typename... KernelTypes>
struct OpKernelRegistrarFunctor<PlaceType, false, I, KernelType...> { struct OpKernelRegistrarFunctor<PlaceType, false, I, KernelTypes...> {
using KT = typename std::tuple_element<I, std::tuple<KernelType...>>::type; using KERNEL_TYPE =
typename std::tuple_element<I, std::tuple<KernelTypes...>>::type;
void operator()(const char* op_type) const { void operator()(const char* op_type) const {
using T = typename KT::ELEMENT_TYPE; using T = typename KERNEL_TYPE::ELEMENT_TYPE;
OperatorWithKernel::OpKernelKey key(ToDataType(std::type_index(typeid(T))), OperatorWithKernel::OpKernelKey key(ToDataType(std::type_index(typeid(T))),
PlaceType()); PlaceType());
OperatorWithKernel::AllOpKernels()[op_type][key].reset(new KT); OperatorWithKernel::AllOpKernels()[op_type][key].reset(new KERNEL_TYPE);
constexpr auto size = std::tuple_size<std::tuple<KernelType...>>::value; constexpr auto size = std::tuple_size<std::tuple<KernelTypes...>>::value;
OpKernelRegistrarFunctor<PlaceType, I + 1 == size, I + 1, KernelType...> OpKernelRegistrarFunctor<PlaceType, I + 1 == size, I + 1, KernelTypes...>
func; func;
func(op_type); func(op_type);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册