Skip to content

Commit

Permalink
Remove old conv2d (#291)
Browse files Browse the repository at this point in the history
* remove old conv2d

* rename conv2dv2 to conv2d

* remove conv2d leftover tests

* rename conv2dv2 to conv2d
  • Loading branch information
alifahrri authored Sep 8, 2024
1 parent bbfda74 commit 0e47853
Show file tree
Hide file tree
Showing 42 changed files with 124 additions and 1,478 deletions.
46 changes: 0 additions & 46 deletions include/nmtools/array/array/conv.hpp

This file was deleted.

4 changes: 2 additions & 2 deletions include/nmtools/array/array/conv2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ namespace nmtools::array
template <typename output_t=none_t, typename context_t=none_t, typename resolver_t=eval_result_t<>
, typename input_t, typename weight_t, typename bias_t=none_t
, typename stride_t=none_t, typename padding_t=none_t, typename dilation_t=none_t, typename groups_t=meta::ct<1>>
constexpr auto conv2dv2(const input_t& input, const weight_t& weight, const bias_t& bias=bias_t{}
constexpr auto conv2d(const input_t& input, const weight_t& weight, const bias_t& bias=bias_t{}
, const stride_t& stride=stride_t{}, const padding_t& padding=padding_t{}, const dilation_t& dilation=dilation_t{}, groups_t groups=groups_t{}
, context_t&& context=context_t{}, output_t&& output=output_t{},meta::as_value<resolver_t> resolver=meta::as_value_v<resolver_t>)
{
auto result = view::conv2dv2(input,weight,bias,stride,padding,dilation,groups);
auto result = view::conv2d(input,weight,bias,stride,padding,dilation,groups);
return eval(result
, nmtools::forward<context_t>(context)
, nmtools::forward<output_t>(output)
Expand Down
44 changes: 0 additions & 44 deletions include/nmtools/array/functional/conv.hpp

This file was deleted.

17 changes: 14 additions & 3 deletions include/nmtools/array/functional/conv1d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,26 @@ namespace nmtools::functional
{
struct conv1d
{
template <typename...args_t>
constexpr auto operator()(const args_t&...args) const
template <typename array_t, typename weight_t, typename...args_t>
constexpr auto operator()(const array_t& array, const weight_t& weight, const args_t&...args) const
{
return view::conv1d(args...);
return view::conv1d(array,weight,None,args...);
}
};

struct conv1d_bias
{
template <typename array_t, typename weight_t, typename bias_t, typename...args_t>
constexpr auto operator()(const array_t& array, const weight_t& weight, const bias_t& bias, const args_t&...args) const
{
return view::conv1d(array,weight,bias,args...);
}
};
} // namespace fun

constexpr inline auto conv1d = functor_t{binary_fmap_t<fun::conv1d>{}};

constexpr inline auto conv1d_bias = functor_t{ternary_fmap_t<fun::conv1d_bias>{}};
} // namespace nmtools::functional

#endif // NMTOOLS_ARRAY_FUNCTIONAL_CONV1D_HPP
21 changes: 16 additions & 5 deletions include/nmtools/array/functional/conv2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,28 @@ namespace nmtools::functional
{
namespace fun
{
struct conv2dv2
struct conv2d_bias
{
template <typename...args_t>
constexpr auto operator()(const args_t&...args) const
template <typename array_t, typename weight_t, typename bias_t, typename...args_t>
constexpr auto operator()(const array_t& array, const weight_t& weight, const bias_t& bias, const args_t&...args) const
{
return view::conv2dv2(args...);
return view::conv2d(array,weight,bias,args...);
}
};

struct conv2d
{
template <typename array_t, typename weight_t, typename...args_t>
constexpr auto operator()(const array_t& array, const weight_t& weight, const args_t&...args) const
{
return view::conv2d(array,weight,None,args...);
}
};
} // namespace fun

constexpr inline auto conv2dv2 = functor_t{binary_fmap_t<fun::conv2dv2>{}};
constexpr inline auto conv2d = functor_t{binary_fmap_t<fun::conv2d>{}};

constexpr inline auto conv2d_bias = functor_t{ternary_fmap_t<fun::conv2d_bias>{}};
} // namespace nmtools::functional

#endif // NMTOOLS_ARRAY_FUNCTIONAL_CONV2D_HPP
Loading

0 comments on commit 0e47853

Please sign in to comment.