@@ -82,28 +82,6 @@ template <> struct RemoveBatchDimAfterTensor<typelist<>> {
82
82
};
83
83
template <class TypeList > using remove_batch_dim_after_tensor_t = typename RemoveBatchDimAfterTensor<TypeList>::type;
84
84
85
- // TODO: get rid of these
86
- // Do I need templates on templates now?
87
- // template <typename func_t> struct LowerToNextLayer {};
88
- // template <typename Return, typename... Args> struct LowerToNextLayer<Return(Args...)> {
89
- // // How to pass in batch_rule directly?
90
- // static Return apply(Args... args);
91
- // };
92
-
93
-
94
- // # Tensor lowerToNextLayer(
95
- // # std::function<std::tuple<Tensor,optional<int64_t>>(const Tensor&, optional<int64_t>)> batch_rule,
96
- // # const Tensor& tensor);
97
- std::tuple<Tensor,optional<int64_t >> abs_batch_rule (const Tensor& tensor, optional<int64_t > batch_dim);
98
-
99
- template <typename F, F Func, typename Return, typename TupleArgs> struct TORCH_API Dummy {};
100
-
101
- template <typename F, F Func, typename Return, typename ...T> struct Dummy <F, Func, Return, std::tuple<T...>> {
102
- static Return apply (T... args) {
103
- return lowerToNextLayer (abs_batch_rule, std::forward<T>(args)...);
104
- }
105
- };
106
-
107
85
template <typename T> struct UnpackSingleItemTuple {
108
86
using type = T;
109
87
};
@@ -123,8 +101,6 @@ struct BuildFunction {
123
101
template <typename Return, typename TL> using build_function_t = typename BuildFunction<Return, TL>::type;
124
102
125
103
126
- // std::tuple<Tensor,optional<int64_t>> (*kAbsBatchRule)(const Tensor& Tensor, optional<int64_t>)
127
- // = &abs_batch_rule;
128
104
template <typename batch_rule_t > struct ToOperatorType {
129
105
using batch_rule_return_type = typename c10::guts::function_traits<batch_rule_t >::return_type;
130
106
using batch_rule_parameter_types = typename c10::guts::function_traits<batch_rule_t >::parameter_types;
@@ -140,30 +116,6 @@ template <typename batch_rule_t> struct ToOperatorType {
140
116
};
141
117
template <typename batch_rule_t > using to_operator_t = typename ToOperatorType<batch_rule_t >::type;
142
118
143
- template <typename F, F Func> struct TORCH_API PrimBatchRule3 {
144
- using func_t = to_operator_t <typename std::remove_pointer<F>::type>;
145
- using result_type = typename c10::guts::function_traits<func_t >::return_type;
146
- using parameter_types = c10::guts::typelist::to_tuple_t <typename c10::guts::function_traits<func_t >::parameter_types>;
147
- static auto apply = Dummy<F, Func, result_type, parameter_types>::apply;
148
- };
149
-
150
- template <typename Return, typename TypeList> struct TORCH_API PrimBatchRule5 {};
151
- template <typename Return, typename ... T> struct PrimBatchRule5 <Return, typelist<T...>> {
152
- static inline Return apply (T... args) {
153
- return lowerToNextLayer (abs_batch_rule, std::forward<T>(args)...);
154
- }
155
- };
156
-
157
- template <typename func_t > struct PrimBatchRule6 {};
158
- template <typename Return, typename ... Args> struct PrimBatchRule6 <Return (Args...)> {
159
- static inline Return apply (Args... args) {
160
- return lowerToNextLayer (abs_batch_rule, std::forward<Args>(args)...);
161
- }
162
- };
163
-
164
- // template<typename batch_rule_t, batch_rule_t BatchRule> struct PrimBatchRule7 {};
165
- // template<typename batch_rule_t, batch_rule_t BatchRule, typename BRReturn, typename... BRArgs>
166
- // struct PrimBatchRule7<BRReturn(*)(BRArgs...), BatchRule> {
167
119
template <typename br_t , br_t BatchRule, typename func_t > struct PrimBatchRule7 {};
168
120
template <typename br_t , br_t BatchRule, typename Return, typename ... Args> struct PrimBatchRule7 <
169
121
br_t , BatchRule, Return (Args...)> {
0 commit comments