Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Commit eccb280

Browse files
committed
Kill dead code
1 parent 03a9fcd commit eccb280

File tree

1 file changed

+0
-48
lines changed

1 file changed

+0
-48
lines changed

functorch/csrc/BatchingMetaprogramming.h

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -82,28 +82,6 @@ template <> struct RemoveBatchDimAfterTensor<typelist<>> {
8282
};
8383
template<class TypeList> using remove_batch_dim_after_tensor_t = typename RemoveBatchDimAfterTensor<TypeList>::type;
8484

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-
10785
template <typename T> struct UnpackSingleItemTuple {
10886
using type = T;
10987
};
@@ -123,8 +101,6 @@ struct BuildFunction {
123101
template <typename Return, typename TL> using build_function_t = typename BuildFunction<Return, TL>::type;
124102

125103

126-
// std::tuple<Tensor,optional<int64_t>> (*kAbsBatchRule)(const Tensor& Tensor, optional<int64_t>)
127-
// = &abs_batch_rule;
128104
template <typename batch_rule_t> struct ToOperatorType {
129105
using batch_rule_return_type = typename c10::guts::function_traits<batch_rule_t>::return_type;
130106
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 {
140116
};
141117
template <typename batch_rule_t> using to_operator_t = typename ToOperatorType<batch_rule_t>::type;
142118

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> {
167119
template<typename br_t, br_t BatchRule, typename func_t> struct PrimBatchRule7 {};
168120
template<typename br_t, br_t BatchRule, typename Return, typename... Args> struct PrimBatchRule7<
169121
br_t, BatchRule, Return (Args...)> {

0 commit comments

Comments
 (0)