Skip to content
Snippets Groups Projects
Commit b1d099b8 authored by Maxence Naud's avatar Maxence Naud
Browse files

[Fix] attribute names in Operators

parent 3ee75f49
No related branches found
No related tags found
3 merge requests!414Update version 0.5.1 -> 0.6.0,!408[Add] Dropout Operator,!346[Fix] mismatch in Operator attribute names
Pipeline #66060 passed
...@@ -28,6 +28,11 @@ namespace Aidge { ...@@ -28,6 +28,11 @@ namespace Aidge {
* @brief Attributes specific to the AvgPooling operation. * @brief Attributes specific to the AvgPooling operation.
*/ */
enum class AvgPoolingAttr { enum class AvgPoolingAttr {
/**
* @brief Kernel dimensions for the pooling operation.
* Specifies the size of the pooling window along each spatial dimension.
*/
KernelDims,
/** /**
* @brief Stride dimensions for sliding the pooling window. * @brief Stride dimensions for sliding the pooling window.
* Specifies the step size of the sliding window along each spatial dimension. * Specifies the step size of the sliding window along each spatial dimension.
...@@ -37,11 +42,6 @@ enum class AvgPoolingAttr { ...@@ -37,11 +42,6 @@ enum class AvgPoolingAttr {
* @brief Dilation along each spatial axis. Default value is 1. * @brief Dilation along each spatial axis. Default value is 1.
*/ */
Dilations, Dilations,
/**
* @brief Kernel dimensions for the pooling operation.
* Specifies the size of the pooling window along each spatial dimension.
*/
KernelDims,
/** /**
* @brief Flag indicating whether to use ceil or floor when calculating output size. * @brief Flag indicating whether to use ceil or floor when calculating output size.
* - `true`: Use `ceil` for output size calculation. * - `true`: Use `ceil` for output size calculation.
...@@ -56,7 +56,7 @@ namespace { ...@@ -56,7 +56,7 @@ namespace {
*/ */
template <> template <>
const char *const EnumStrings<Aidge::AvgPoolingAttr>::data[] = { const char *const EnumStrings<Aidge::AvgPoolingAttr>::data[] = {
"stride_dims", "kernel_dims", "dilations", "ceil_mode" "kernel_dims", "stride_dims", "dilations", "ceil_mode"
}; };
} }
namespace Aidge { namespace Aidge {
......
...@@ -32,26 +32,25 @@ namespace Aidge { ...@@ -32,26 +32,25 @@ namespace Aidge {
/** /**
* @enum MaxPoolingAttr * @enum MaxPoolingAttr
* @brief Attributes defining the configuration of a MaxPooling operation. * @brief Attributes defining the configuration of a MaxPooling Operator.
*/ */
enum class MaxPoolingAttr { enum class MaxPoolingAttr {
/**
* @brief Kernel dimensions specifying the size of the pooling window for each spatial dimension.
* Must be an array of positive integers. Common examples include [2,2] or [3,3].
*/
KernelDims,
/** /**
* @brief Stride dimensions for sliding the pooling window across the input dimensions. * @brief Stride dimensions for sliding the pooling window across the input dimensions.
* The stride specifies how much the window moves after each operation. * The stride specifies how much the window moves after each operation.
* Must be positive integers. * Must be an array of positive integers. For example, [1,1] or [2,2].
*/ */
StrideDims, StrideDims,
/** /**
* @brief Dilation along each spatial axis. Default value is 1. * @brief Dilation along each spatial axis. Default value is 1 for all axes.
* Must be an array of positive integers. For example, [1,1].
*/ */
Dilations, Dilations,
/**
* @brief Kernel dimensions specifying the size of the pooling window for each spatial dimension.
* For example, common kernel dimensions include 2x2 or 3x3.
* Must be positive integers.
*/
KernelDims,
/** /**
* @brief Flag indicating whether to use ceil or floor when calculating output size. * @brief Flag indicating whether to use ceil or floor when calculating output size.
* - `true`: Use `ceil` for output size calculation. * - `true`: Use `ceil` for output size calculation.
...@@ -65,7 +64,7 @@ namespace { ...@@ -65,7 +64,7 @@ namespace {
* @brief String representations of MaxPooling attributes for debugging and logging. * @brief String representations of MaxPooling attributes for debugging and logging.
*/ */
template <> template <>
const char *const EnumStrings<Aidge::MaxPoolingAttr>::data[] = {"stride_dims", "kernel_dims", "dilations", "ceil_mode"}; const char *const EnumStrings<Aidge::MaxPoolingAttr>::data[] = {"kernel_dims", "stride_dims", "dilations", "ceil_mode"};
} }
namespace Aidge{ namespace Aidge{
...@@ -107,13 +106,12 @@ class MaxPooling_Op : public OperatorTensor, ...@@ -107,13 +106,12 @@ class MaxPooling_Op : public OperatorTensor,
public: public:
static const std::string Type; ///< Static identifier for this operator type. static const std::string Type; ///< Static identifier for this operator type.
private:
using Attributes_ = StaticAttributes<MaxPoolingAttr, using Attributes_ = StaticAttributes<MaxPoolingAttr,
std::array<DimSize_t, DIM>, std::array<DimSize_t, DIM>,
std::array<DimSize_t, DIM>, std::array<DimSize_t, DIM>,
std::array<DimSize_t, DIM>, std::array<DimSize_t, DIM>,
bool>; bool>;
private:
template <MaxPoolingAttr e> template <MaxPoolingAttr e>
using attr = typename Attributes_::template attr<e>; using attr = typename Attributes_::template attr<e>;
const std::shared_ptr<Attributes_> mAttributes; ///< Shared pointer to operator attributes. const std::shared_ptr<Attributes_> mAttributes; ///< Shared pointer to operator attributes.
......
...@@ -107,7 +107,7 @@ namespace { ...@@ -107,7 +107,7 @@ namespace {
* @brief String representations of the Stack operator's attributes. * @brief String representations of the Stack operator's attributes.
*/ */
template <> template <>
const char *const EnumStrings<Aidge::StackAttr>::data[] = {"forward_step", "max_elements"}; const char *const EnumStrings<Aidge::StackAttr>::data[] = {"forward_step", "backward_step", "max_elements"};
} }
namespace Aidge { namespace Aidge {
/** /**
......
...@@ -29,8 +29,8 @@ Aidge::MaxPooling_Op<DIM>::MaxPooling_Op(const std::array<Aidge::DimSize_t, DIM> ...@@ -29,8 +29,8 @@ Aidge::MaxPooling_Op<DIM>::MaxPooling_Op(const std::array<Aidge::DimSize_t, DIM>
bool ceil_mode) bool ceil_mode)
: OperatorTensor(Type, {InputCategory::Data}, 1), : OperatorTensor(Type, {InputCategory::Data}, 1),
mAttributes(std::make_shared<Attributes_>( mAttributes(std::make_shared<Attributes_>(
attr<MaxPoolingAttr::StrideDims>(stride_dims),
attr<MaxPoolingAttr::KernelDims>(kernel_dims), attr<MaxPoolingAttr::KernelDims>(kernel_dims),
attr<MaxPoolingAttr::StrideDims>(stride_dims),
attr<MaxPoolingAttr::Dilations>(dilations), attr<MaxPoolingAttr::Dilations>(dilations),
attr<MaxPoolingAttr::CeilMode>(ceil_mode))) attr<MaxPoolingAttr::CeilMode>(ceil_mode)))
{} {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment