Skip to content
Snippets Groups Projects
Commit a19d8e63 authored by Grégoire Kubler's avatar Grégoire Kubler
Browse files

Merge branch 'dev' of https://gitlab.eclipse.org/eclipse/aidge/aidge_core into...

Merge branch 'dev' of https://gitlab.eclipse.org/eclipse/aidge/aidge_core into feat/operator_globalAveragePooling
parents d739bd2f f3364c9f
No related branches found
No related tags found
No related merge requests found
Pipeline #42675 passed
......@@ -19,7 +19,7 @@ option(PYBIND "python binding" ON)
option(WERROR "Warning as error" OFF)
option(TEST "Enable tests" ON)
option(COVERAGE "Enable coverage" OFF)
option(ENABLE_ASAN "Enable ASan (adress sanitizer) for runtime analysis of memory use (over/underflow, memory leak, ...)" OFF)
option(ENABLE_ASAN "Enable ASan (AddressSanitizer) for runtime analysis of memory use (over/underflow, memory leak, ...)" OFF)
##############################################
# Import utils CMakeLists
......
......@@ -457,12 +457,13 @@ private:
*/
void addParent(const NodePtr otherNode, const IOIndex_t inId);
/**
* @brief operator<< overload to ease print & debug of nodes
* @param[inout] ostream to print to
* @param[in] n node to print
*/
friend std::ostream& operator << (std::ostream& os, Node& n);
// OPERATOR FUNCTIONNAL but commented out to avoid iostream inclusion
// /**
// * @brief operator<< overload to ease print & debug of nodes
// * @param[inout] ostream to print to
// * @param[in] n node to print
// */
// friend std::ostream& operator << (std::ostream& os, Node& n);
};
} // namespace Aidge
......
......@@ -17,8 +17,6 @@
#include <vector>
#include "aidge/backend/OperatorImpl.hpp"
#include "aidge/data/Data.hpp"
#include "aidge/data/Tensor.hpp"
#include "aidge/graph/Node.hpp"
#include "aidge/operator/OperatorTensor.hpp"
#include "aidge/utils/Registrar.hpp"
......@@ -43,9 +41,9 @@ public:
GlobalAveragePooling_Op(const GlobalAveragePooling_Op &op)
: OperatorTensor(op) {
if (op.mImpl){
SET_IMPL_MACRO(GlobalAveragePooling_Op, *this, op.mOutputs[0]->getImpl()->backend());
}else{
if (op.mImpl) {
SET_IMPL_MACRO(GlobalAveragePooling_Op, *this, op.backend());
} else {
mImpl = nullptr;
}
}
......@@ -56,10 +54,7 @@ public:
void computeOutputDims() override final;
void setBackend(const std::string &name, DeviceIdx_t device = 0) override {
SET_IMPL_MACRO(GlobalAveragePooling_Op, *this, name);
mOutputs[0]->setBackend(name, device);
}
void setBackend(const std::string &name, DeviceIdx_t device = 0) override final;
static const std::vector<std::string> getInputsName() {
return {"data_input"};
......
......@@ -173,6 +173,7 @@ void Aidge::Node::setInputId(const IOIndex_t inId, const IOIndex_t newNodeoutId)
"Input index ({}) is out of bound ({}) for node {} (of type {})",
inId, nbInputs(), name(), type());
if (mIdOutParents[inId] != gk_IODefaultIndex) {
Log::warn("Warning: filling a Tensor already attributed\n");
auto originalParent = input(inId);
// remove original parent reference to child
// find the output ID for original Parent
......@@ -390,25 +391,25 @@ std::set<Aidge::NodePtr> Aidge::Node::getNodeDelta(int delta, std::set<Aidge::No
return out;
}
namespace Aidge {
std::ostream& operator << (std::ostream& os, Aidge::Node& n) {
using namespace std;
os << "Node :\tName :\t\"" << n.name() << "\"\tType : \"" << n.getOperator()->type()<< "\"\tIN/OUTputs : "<< n.nbInputs() <<"/"<< n.nbOutputs() <<endl;
os << "\tParents :\t" ;
for (const auto & p : n.getParents())
{
os << "\"" <<p->name() << "\"\t";
}
os << endl;
os << "\tChildren :\t" ;
for (const auto & c : n.getChildren())
{
os << "\"" << c->name() << "\"\t";
}
os << endl;
return os;
}
}
// namespace Aidge {
// std::ostream& operator << (std::ostream& os, Aidge::Node& n) {
// using namespace std;
// os << "Node :\tName :\t\"" << n.name() << "\"\tType : \"" << n.getOperator()->type()<< "\"\tIN/OUTputs : "<< n.nbInputs() <<"/"<< n.nbOutputs() <<endl;
// os << "\tParents :\t" ;
// for (const auto & p : n.getParents())
// {
// os << "\"" <<p->name() << "\"\t";
// }
// os << endl;
// os << "\tChildren :\t" ;
// for (const auto & c : n.getChildren())
// {
// os << "\"" << c->name() << "\"\t";
// }
// os << endl;
// return os;
// }
// }
/////////////////////////////////////////////////////////////////////////////////////////////
// private
......
......@@ -9,10 +9,15 @@
*
********************************************************************************/
#include <memory>
#include <stdexcept> // std::runtime_error
#include <string>
#include <vector>
#include "aidge/data/Tensor.hpp"
#include "aidge/operator/GlobalAveragePooling.hpp"
#include "aidge/utils/ErrorHandling.hpp"
#include "aidge/utils/Types.h"
const std::string Aidge::GlobalAveragePooling_Op::Type = "GlobalAveragePooling";
......@@ -40,3 +45,8 @@ void Aidge::GlobalAveragePooling_Op::computeOutputDims() {
mOutputs[0]->resize(out_dims);
}
}
void Aidge::GlobalAveragePooling_Op::setBackend(const std::string &name, Aidge::DeviceIdx_t device) {
SET_IMPL_MACRO(GlobalAveragePooling_Op, *this, name);
mOutputs[0]->setBackend(name, device);
}
\ No newline at end of file
......@@ -44,6 +44,7 @@ TEST_CASE("randomScheduling", "[Scheduler][randomGen]") {
const size_t nb_nodes = nb_nodes_dist(gen);
SECTION("Acyclic Graph") {
Aidge::Log::setConsoleLevel(Aidge::Log::Warn);
fmt::print("gen acyclic graph of {} nodes...\n", nb_nodes);
randGraph.acyclic = true;
......@@ -64,8 +65,8 @@ TEST_CASE("randomScheduling", "[Scheduler][randomGen]") {
g1->add(prod);
}
// g1->save("schedule");
g1->forwardDims();
g1->save("schedule");
g1->compile();
fmt::print("gen scheduling...\n");
auto scheduler = SequentialScheduler(g1);
......
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