diff --git a/include/aidge/operator/MetaOperator.hpp b/include/aidge/operator/MetaOperator.hpp index e7329ec15f91f941b0f7af1adca145f4260d53fa..85f61a18f923c34f08dcce9385505a54a5420173 100644 --- a/include/aidge/operator/MetaOperator.hpp +++ b/include/aidge/operator/MetaOperator.hpp @@ -296,18 +296,16 @@ inline std::shared_ptr<Node> PaddedConv(DimSize_t in_channels, const std::array<std::array<DimSize_t, 2>, DIM> &padding_dims = {0}, const std::array<DimSize_t, DIM> &dilation_dims = create_array<DimSize_t,DIM>(1)) { - auto pad = Pad<DIM>(padding_dims, (!name.empty()) ? name + "_pad" : ""); - auto conv = Conv<DIM>(in_channels, out_channels, kernel_dims, (!name.empty()) ? name + "_conv" : "", stride_dims, dilation_dims); - pad->addChild(conv); - - // Graph has to be created manually in order to exclude Producers from the graph - auto graph = std::make_shared<GraphView>(); - graph->add(pad); - graph->add(conv, false); // exclude Producers, as they should be inputs of the meta-op - + // Construct micro-graph + auto pad = std::make_shared<Node>(std::make_shared<Pad_Op<static_cast<DimIdx_t>(DIM)>>(padding_dims, PadBorderType::Constant, 0.0), (!name.empty()) ? name + "_pad" : ""); + auto conv = std::make_shared<Node>(std::make_shared<Conv_Op<static_cast<DimIdx_t>(DIM)>>(in_channels, out_channels, kernel_dims, stride_dims, dilation_dims), (!name.empty()) ? name + "_conv" : ""); // Need to specify the ordered list of input operators const std::vector<NodePtr> orderedInputNodes = {pad, conv}; - return std::make_shared<Node>(std::make_shared<MetaOperator_Op>("PaddedConv", graph, orderedInputNodes), name); + + auto metaOp = std::make_shared<Node>(std::make_shared<MetaOperator_Op>("PaddedConv", Sequential({pad, conv}), orderedInputNodes), name); + addProducer(metaOp, 1, append(out_channels, append(in_channels, kernel_dims)), "w"); + addProducer(metaOp, 2, {out_channels}, "b"); + return metaOp; } template <DimSize_t DIM>