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

Merge branch 'standardization' into 'main'

[Upd] #define guard that were using system implementation convention

See merge request !2
parents c436ffb0 75a0d5a6
No related branches found
No related tags found
1 merge request!2[Upd] #define guard that were using system implementation convention
Pipeline #30922 failed
Showing
with 137 additions and 137 deletions
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_IMPORTS_H__ #ifndef AIDGE_IMPORTS_H_
#define __AIDGE_IMPORTS_H__ #define AIDGE_IMPORTS_H_
#include "aidge/backend/OperatorImpl.hpp" #include "aidge/backend/OperatorImpl.hpp"
#include "aidge/backend/TensorImpl.hpp" #include "aidge/backend/TensorImpl.hpp"
...@@ -48,4 +48,4 @@ ...@@ -48,4 +48,4 @@
//#include "aidge/utilsParsing/AstNode.hpp" //#include "aidge/utilsParsing/AstNode.hpp"
//#include "aidge/utilsParsing/ParsingToken.hpp" //#include "aidge/utilsParsing/ParsingToken.hpp"
#endif /* __AIDGE_IMPORTS_H__ */ #endif /* AIDGE_IMPORTS_H_ */
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_OPERATORIMPL_H__ #ifndef AIDGE_OPERATORIMPL_H_
#define __AIDGE_OPERATORIMPL_H__ #define AIDGE_OPERATORIMPL_H_
#include <cstddef> #include <cstddef>
#include <vector> #include <vector>
...@@ -57,4 +57,4 @@ public: ...@@ -57,4 +57,4 @@ public:
}; };
} // namespace Aidge } // namespace Aidge
#endif /* __AIDGE_OPERATORIMPL_H__ */ #endif /* AIDGE_OPERATORIMPL_H_ */
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_TENSORIMPL_H__ #ifndef AIDGE_TENSORIMPL_H_
#define __AIDGE_TENSORIMPL_H__ #define AIDGE_TENSORIMPL_H_
#include <cstddef> #include <cstddef>
#include <cstdio> #include <cstdio>
...@@ -26,7 +26,7 @@ public: ...@@ -26,7 +26,7 @@ public:
virtual void setRawPtr(void* /*ptr*/) virtual void setRawPtr(void* /*ptr*/)
{ {
printf("Cannot set raw pointer for backend %s\n", mBackend); printf("Cannot set raw pointer for backend %s\n", mBackend);
}; };
virtual std::size_t scalarSize() const = 0; // Size of one scalar (in bytes) virtual std::size_t scalarSize() const = 0; // Size of one scalar (in bytes)
constexpr const char *backend() const { return mBackend; } constexpr const char *backend() const { return mBackend; }
virtual ~TensorImpl() = default; virtual ~TensorImpl() = default;
...@@ -38,4 +38,4 @@ private: ...@@ -38,4 +38,4 @@ private:
} // namespace Aidge } // namespace Aidge
#endif /* __AIDGE_TENSORIMPL_H__ */ #endif /* AIDGE_TENSORIMPL_H_ */
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_DATA_H__ #ifndef AIDGE_DATA_H_
#define __AIDGE_DATA_H__ #define AIDGE_DATA_H_
#include "aidge/utils/Parameter.hpp" #include "aidge/utils/Parameter.hpp"
...@@ -66,10 +66,10 @@ template <> const Aidge::DataType NativeType<int>::type = Aidge::DataType::Int32 ...@@ -66,10 +66,10 @@ template <> const Aidge::DataType NativeType<int>::type = Aidge::DataType::Int32
template <> template <>
const char* const EnumStrings<Aidge::DataType>::data[] const char* const EnumStrings<Aidge::DataType>::data[]
= {"Float64", "Float32", "Float16", "BFloat16", "Binary", "Ternary", = {"Float64", "Float32", "Float16", "BFloat16", "Binary", "Ternary",
"Int2", "Int3", "Int4", "Int5", "Int6", "Int7", "Int8", "Int16", "Int2", "Int3", "Int4", "Int5", "Int6", "Int7", "Int8", "Int16",
"Int32", "Int64", "UInt2", "UInt3", "UInt4", "UInt5", "UInt6", "Int32", "Int64", "UInt2", "UInt3", "UInt4", "UInt5", "UInt6",
"UInt7", "UInt8", "UInt16", "UInt32", "UInt64"}; "UInt7", "UInt8", "UInt16", "UInt32", "UInt64"};
} }
#endif /* __AIDGE_DATA_H__ */ #endif /* AIDGE_DATA_H_ */
\ No newline at end of file \ No newline at end of file
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_CORE_DATA_TENSOR_H__ #ifndef AIDGE_CORE_DATA_TENSOR_H_
#define __AIDGE_CORE_DATA_TENSOR_H__ #define AIDGE_CORE_DATA_TENSOR_H_
#include <cstring> #include <cstring>
#include <set> #include <set>
...@@ -156,10 +156,10 @@ class Tensor : public Data, ...@@ -156,10 +156,10 @@ class Tensor : public Data,
* @param dataType Sets the type of inserted data. * @param dataType Sets the type of inserted data.
*/ */
Tensor(DataType dataType = DataType::Float32) Tensor(DataType dataType = DataType::Float32)
: Data(Type), : Data(Type),
mDataType(dataType), mDataType(dataType),
mDims({}), mDims({}),
mSize(0), mSize(0),
mSizeM1(0) mSizeM1(0)
{ {
// ctor // ctor
...@@ -167,14 +167,14 @@ class Tensor : public Data, ...@@ -167,14 +167,14 @@ class Tensor : public Data,
/** /**
* @brief Construct a new Tensor object copied from another one. * @brief Construct a new Tensor object copied from another one.
* @param otherTensor * @param otherTensor
*/ */
Tensor(const Tensor& otherTensor) Tensor(const Tensor& otherTensor)
: Data(Type), : Data(Type),
mDataType(otherTensor.mDataType), mDataType(otherTensor.mDataType),
mDims(otherTensor.mDims), mDims(otherTensor.mDims),
mSize(otherTensor.mSize), mSize(otherTensor.mSize),
mSizeM1(otherTensor.mSizeM1) mSizeM1(otherTensor.mSizeM1)
{ {
if (otherTensor.hasImpl()) { if (otherTensor.hasImpl()) {
mImpl = Registrar<Tensor>::create({otherTensor.mImpl->backend(), dataType()})(*this); mImpl = Registrar<Tensor>::create({otherTensor.mImpl->backend(), dataType()})(*this);
...@@ -312,7 +312,7 @@ class Tensor : public Data, ...@@ -312,7 +312,7 @@ class Tensor : public Data,
/** /**
* @brief Assess data type, dimensions, backend and data are the same. * @brief Assess data type, dimensions, backend and data are the same.
* @param otherTensor * @param otherTensor
*/ */
bool operator==(const Tensor &otherTensor) const { bool operator==(const Tensor &otherTensor) const {
if ((!mImpl && !otherTensor.mImpl) || (dataType() != otherTensor.dataType()) || if ((!mImpl && !otherTensor.mImpl) || (dataType() != otherTensor.dataType()) ||
...@@ -325,7 +325,7 @@ class Tensor : public Data, ...@@ -325,7 +325,7 @@ class Tensor : public Data,
/** /**
* @brief Set the backend of the Tensor associated implementation * @brief Set the backend of the Tensor associated implementation
* @details Create and initialized an implementation if non was associated. * @details Create and initialized an implementation if non was associated.
* @param name * @param name
*/ */
inline void setBackend(const std::string &name) { inline void setBackend(const std::string &name) {
if (mImpl) { if (mImpl) {
...@@ -342,7 +342,7 @@ class Tensor : public Data, ...@@ -342,7 +342,7 @@ class Tensor : public Data,
/** /**
* @brief Get a list of available backends. * @brief Get a list of available backends.
* @return std::set<std::string> * @return std::set<std::string>
*/ */
static std::set<std::string> getAvailableBackends(){ static std::set<std::string> getAvailableBackends(){
std::set<std::string> backendsList; std::set<std::string> backendsList;
...@@ -353,7 +353,7 @@ class Tensor : public Data, ...@@ -353,7 +353,7 @@ class Tensor : public Data,
/** /**
* @brief Get the data type enum. * @brief Get the data type enum.
* @return constexpr DataType * @return constexpr DataType
*/ */
constexpr DataType dataType() const { return mDataType; } constexpr DataType dataType() const { return mDataType; }
...@@ -376,27 +376,27 @@ class Tensor : public Data, ...@@ -376,27 +376,27 @@ class Tensor : public Data,
/** /**
* @brief Get the Impl object * @brief Get the Impl object
* @return constexpr const std::unique_ptr<TensorImpl>& * @return constexpr const std::unique_ptr<TensorImpl>&
*/ */
constexpr const std::unique_ptr<TensorImpl> &getImpl() { return mImpl; } constexpr const std::unique_ptr<TensorImpl> &getImpl() { return mImpl; }
/** /**
* @brief Return if an implementaiton has been associated. * @brief Return if an implementaiton has been associated.
* @return true * @return true
* @return false * @return false
*/ */
bool hasImpl() const { return (mImpl) ? true : false; } bool hasImpl() const { return (mImpl) ? true : false; }
/** /**
* @brief Get number of dimensions of the Tensor. * @brief Get number of dimensions of the Tensor.
* @return std::size_t * @return std::size_t
*/ */
inline std::size_t nbDims() const { return mDims.size(); } inline std::size_t nbDims() const { return mDims.size(); }
/** /**
* @brief Get dimensions of the Tensor object. * @brief Get dimensions of the Tensor object.
* @tparam DIM number of dimensions. * @tparam DIM number of dimensions.
* @return constexpr std::array<DimSize_t, DIM> * @return constexpr std::array<DimSize_t, DIM>
*/ */
template <DimIdx_t DIM> template <DimIdx_t DIM>
constexpr std::array<DimSize_t, DIM> dims() const { constexpr std::array<DimSize_t, DIM> dims() const {
...@@ -406,26 +406,26 @@ class Tensor : public Data, ...@@ -406,26 +406,26 @@ class Tensor : public Data,
/** /**
* @brief Get dimensions of the Tensor object. * @brief Get dimensions of the Tensor object.
* @return constexpr const std::vector<DimSize_t>& * @return constexpr const std::vector<DimSize_t>&
*/ */
constexpr const std::vector<DimSize_t> &dims() const { return mDims; } constexpr const std::vector<DimSize_t> &dims() const { return mDims; }
/** /**
* @brief Get the number of elements in the Tensor object. * @brief Get the number of elements in the Tensor object.
* @return constexpr std::size_t * @return constexpr std::size_t
*/ */
constexpr std::size_t size() const { return mSize; } constexpr std::size_t size() const { return mSize; }
/** /**
* @brief Get the number of elements in the N-1 dimensions of the Tensor object. * @brief Get the number of elements in the N-1 dimensions of the Tensor object.
* @return constexpr std::size_t * @return constexpr std::size_t
*/ */
constexpr std::size_t sizeM1() const { return mSizeM1; } constexpr std::size_t sizeM1() const { return mSizeM1; }
/** /**
* @brief Change the shape of the Tensor object according to the given argument. * @brief Change the shape of the Tensor object according to the given argument.
* @tparam DIM new dimensions. * @tparam DIM new dimensions.
* @param dims * @param dims
*/ */
template <std::array<DimSize_t, 1>::size_type DIM> // deducing std::array size_type and declaring DIM accordingly template <std::array<DimSize_t, 1>::size_type DIM> // deducing std::array size_type and declaring DIM accordingly
void resize(const std::array<DimSize_t, DIM> &dims) { void resize(const std::array<DimSize_t, DIM> &dims) {
...@@ -441,8 +441,8 @@ class Tensor : public Data, ...@@ -441,8 +441,8 @@ class Tensor : public Data,
/** /**
* @brief Return if the Tensor object has at leastone element. * @brief Return if the Tensor object has at leastone element.
* @return true * @return true
* @return false * @return false
*/ */
bool empty() const { return mDims.empty(); } bool empty() const { return mDims.empty(); }
...@@ -540,8 +540,8 @@ class Tensor : public Data, ...@@ -540,8 +540,8 @@ class Tensor : public Data,
} }
} }
} }
res += "}"; res += "}";
return res; return res;
} }
...@@ -575,10 +575,10 @@ private: ...@@ -575,10 +575,10 @@ private:
mSizeM1 = std::accumulate(++mDims.begin(),mDims.end(), DimSize_t(1), std::multiplies<DimSize_t>()); mSizeM1 = std::accumulate(++mDims.begin(),mDims.end(), DimSize_t(1), std::multiplies<DimSize_t>());
mSize = static_cast<std::size_t>(mSizeM1 * mDims[0]); mSize = static_cast<std::size_t>(mSizeM1 * mDims[0]);
} }
return mSize; return mSize;
} }
}; };
} // namespace Aidge } // namespace Aidge
#endif /* __AIDGE_CORE_DATA_TENSOR_H__ */ #endif /* AIDGE_CORE_DATA_TENSOR_H_ */
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
* SPDX-License-Identifier: EPL-2.0 * SPDX-License-Identifier: EPL-2.0
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_CORE_GRAPH_CONNECTOR_H__ #ifndef AIDGE_CORE_GRAPH_CONNECTOR_H_
#define __AIDGE_CORE_GRAPH_CONNECTOR_H__ #define AIDGE_CORE_GRAPH_CONNECTOR_H_
#include <cassert> #include <cassert>
#include <memory> #include <memory>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "aidge/utils/Types.h" #include "aidge/utils/Types.h"
namespace Aidge { namespace Aidge {
class Node; class Node;
class GraphView; class GraphView;
/** /**
...@@ -83,4 +83,4 @@ class Connector { ...@@ -83,4 +83,4 @@ class Connector {
std::shared_ptr<GraphView> generateGraph(std::vector<Connector> ctors); std::shared_ptr<GraphView> generateGraph(std::vector<Connector> ctors);
} // namespace Aidge } // namespace Aidge
#endif /* __AIDGE_CORE_GRAPH_CONNECTOR_H__ */ #endif /* AIDGE_CORE_GRAPH_CONNECTOR_H_ */
\ No newline at end of file \ No newline at end of file
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_CORE_GRAPH_GRAPHVIEW_H__ #ifndef AIDGE_CORE_GRAPH_GRAPHVIEW_H_
#define __AIDGE_CORE_GRAPH_GRAPHVIEW_H__ #define AIDGE_CORE_GRAPH_GRAPHVIEW_H_
#include <map> #include <map>
#include <memory> #include <memory>
...@@ -33,14 +33,14 @@ enum class DataType; ...@@ -33,14 +33,14 @@ enum class DataType;
class GraphView : public std::enable_shared_from_this<GraphView> { class GraphView : public std::enable_shared_from_this<GraphView> {
private: private:
/// @brief Name of the graphview /// @brief Name of the graphview
std::string mName; std::string mName;
/// @brief Set of nodes included in the GraphView /// @brief Set of nodes included in the GraphView
std::set<NodePtr> mNodes; std::set<NodePtr> mNodes;
/// @brief Set of nodes included in the graphview with names /// @brief Set of nodes included in the graphview with names
std::map<std::string, NodePtr> mNodeRegistry; std::map<std::string, NodePtr> mNodeRegistry;
/// @brief Nodes without input link /// @brief Nodes without input link
std::set<NodePtr> mInputNodes; std::set<NodePtr> mInputNodes;
...@@ -49,23 +49,23 @@ private: ...@@ -49,23 +49,23 @@ private:
public: public:
GraphView(std::string name="") GraphView(std::string name="")
: mName(name) : mName(name)
{ {
// ctor // ctor
} }
// GraphView(std::set<NodePtr> nodes, std::string name="") // GraphView(std::set<NodePtr> nodes, std::string name="")
// : mName(name) // : mName(name)
// { // {
// add(nodes); // add(nodes);
// } // }
bool operator==(const GraphView &gv) const bool operator==(const GraphView &gv) const
{ {
return mNodes == gv.mNodes; return mNodes == gv.mNodes;
} }
NodePtr operator[](std::string name) NodePtr operator[](std::string name)
{ {
assert(mNodeRegistry.find(name) != mNodeRegistry.end() && "Could not find Node in the GraphView."); assert(mNodeRegistry.find(name) != mNodeRegistry.end() && "Could not find Node in the GraphView.");
return mNodeRegistry.at(name); return mNodeRegistry.at(name);
...@@ -185,7 +185,7 @@ public: ...@@ -185,7 +185,7 @@ public:
/** /**
* @brief Get parents Nodes of the specified Node. * @brief Get parents Nodes of the specified Node.
* @param nodeName Name of the Node. * @param nodeName Name of the Node.
* @return std::vector<NodePtr> * @return std::vector<NodePtr>
*/ */
std::vector<NodePtr> getParents(const std::string nodeName) const; std::vector<NodePtr> getParents(const std::string nodeName) const;
std::vector<std::vector<NodePtr>> getOrderedParents() const; std::vector<std::vector<NodePtr>> getOrderedParents() const;
...@@ -206,7 +206,7 @@ public: ...@@ -206,7 +206,7 @@ public:
/** /**
* @brief Get the Nodes pointed to by the GraphView object. * @brief Get the Nodes pointed to by the GraphView object.
* @return std::set<NodePtr> * @return std::set<NodePtr>
*/ */
inline std::set<NodePtr> getNodes() const { return mNodes; } inline std::set<NodePtr> getNodes() const { return mNodes; }
...@@ -233,14 +233,14 @@ public: ...@@ -233,14 +233,14 @@ public:
/** /**
* @brief Include a Node to the current GraphView object. * @brief Include a Node to the current GraphView object.
* @param other_Nde Node to add. * @param other_Nde Node to add.
* @param includeLearnableParam Include non-data inputs, like weights and biases * @param includeLearnableParam Include non-data inputs, like weights and biases
* in the GraphView automatically. Default: true. * in the GraphView automatically. Default: true.
*/ */
void add(NodePtr otherNode, bool includeLearnableParam = true); void add(NodePtr otherNode, bool includeLearnableParam = true);
/** /**
* @brief Include a set of Nodes to the current GraphView object. * @brief Include a set of Nodes to the current GraphView object.
* @param otherNodes * @param otherNodes
* @param includeLearnableParam * @param includeLearnableParam
*/ */
void add(std::set<NodePtr> otherNodes, void add(std::set<NodePtr> otherNodes,
bool includeLearnableParam = true); bool includeLearnableParam = true);
...@@ -326,8 +326,8 @@ public: ...@@ -326,8 +326,8 @@ public:
/** /**
* @brief Replace the current GraphView with the set of given Nodes if possible * @brief Replace the current GraphView with the set of given Nodes if possible
* @param newNodes Set of Nodes. * @param newNodes Set of Nodes.
* @return true * @return true
* @return false * @return false
*/ */
bool replaceWith(std::set<NodePtr> newNodes); bool replaceWith(std::set<NodePtr> newNodes);
void updateInputNodes(); void updateInputNodes();
...@@ -343,13 +343,13 @@ private: ...@@ -343,13 +343,13 @@ private:
/** /**
* @brief Get the sum of the number of dataInput Nodes for all inputNodes of the GraphView object. * @brief Get the sum of the number of dataInput Nodes for all inputNodes of the GraphView object.
* @return IOIndex_t * @return IOIndex_t
*/ */
IOIndex_t getNbDataInputs() const; IOIndex_t getNbDataInputs() const;
/** /**
* @brief Get the sum of the number of free dataInput connection for all inputNodes of the GraphView object. * @brief Get the sum of the number of free dataInput connection for all inputNodes of the GraphView object.
* @return IOIndex_t * @return IOIndex_t
*/ */
IOIndex_t getNbFreeDataInputs() const; IOIndex_t getNbFreeDataInputs() const;
...@@ -378,4 +378,4 @@ private: ...@@ -378,4 +378,4 @@ private:
}; };
} // namespace Aidge } // namespace Aidge
#endif /* __AIDGE_CORE_GRAPH_GRAPHVIEW_H__ */ #endif /* AIDGE_CORE_GRAPH_GRAPHVIEW_H_ */
\ No newline at end of file \ No newline at end of file
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_CORE_GRAPH_NODE_H__ #ifndef AIDGE_CORE_GRAPH_NODE_H_
#define __AIDGE_CORE_GRAPH_NODE_H__ #define AIDGE_CORE_GRAPH_NODE_H_
#include <cassert> #include <cassert>
#include <memory> #include <memory>
...@@ -39,7 +39,7 @@ private: ...@@ -39,7 +39,7 @@ private:
// Compare the content of the weak_ptrs // Compare the content of the weak_ptrs
auto sharedA = a.lock(); auto sharedA = a.lock();
auto sharedB = b.lock(); auto sharedB = b.lock();
if (!sharedB) return false; // nothing after expired pointer if (!sharedB) return false; // nothing after expired pointer
if (!sharedA) return true; if (!sharedA) return true;
return sharedA < sharedB; // shared_ptr has a valid comparison operator return sharedA < sharedB; // shared_ptr has a valid comparison operator
} }
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
/** /**
* @brief Functional operator for user-friendly connection interface using an ordered set of Connectors. * @brief Functional operator for user-friendly connection interface using an ordered set of Connectors.
* @param ctors Ordered Connectors linking their associated Node to the input of the current Node with the same index. * @param ctors Ordered Connectors linking their associated Node to the input of the current Node with the same index.
* @return Connector * @return Connector
*/ */
Connector operator()(const std::vector<Connector> &ctors); Connector operator()(const std::vector<Connector> &ctors);
...@@ -165,7 +165,7 @@ public: ...@@ -165,7 +165,7 @@ public:
/** /**
* @brief Set fix value for the specified input by creating a Producer wrapping the given Tensor. * @brief Set fix value for the specified input by creating a Producer wrapping the given Tensor.
* *
* @param idx Input index. * @param idx Input index.
* @param tensor Constant Tensor to add as parent for specified index. * @param tensor Constant Tensor to add as parent for specified index.
*/ */
...@@ -301,7 +301,7 @@ public: ...@@ -301,7 +301,7 @@ public:
/** /**
* @brief Get the pointer to parent of the specified input index. This pointer is nullptr if no parent is linked. * @brief Get the pointer to parent of the specified input index. This pointer is nullptr if no parent is linked.
* @param inId Input index. * @param inId Input index.
* @return std::shared_ptr<Node>& * @return std::shared_ptr<Node>&
*/ */
inline NodePtr &getParents(const IOIndex_t inId) { inline NodePtr &getParents(const IOIndex_t inId) {
assert(inId != gk_IODefaultIndex); assert(inId != gk_IODefaultIndex);
...@@ -312,7 +312,7 @@ public: ...@@ -312,7 +312,7 @@ public:
* @brief Unlink the parent Node at the specified input index and return its pointer. * @brief Unlink the parent Node at the specified input index and return its pointer.
* Return a nullptr is no parent was linked. * Return a nullptr is no parent was linked.
* @param inId Input index. * @param inId Input index.
* @return std::shared_ptr<Node> * @return std::shared_ptr<Node>
*/ */
NodePtr popParent(const IOIndex_t inId); NodePtr popParent(const IOIndex_t inId);
...@@ -331,7 +331,7 @@ public: ...@@ -331,7 +331,7 @@ public:
/** /**
* @brief Get the list of children Nodes linked to the output at specified index. * @brief Get the list of children Nodes linked to the output at specified index.
* @param outId Output index. * @param outId Output index.
* @return std::vector<std::shared_ptr<Node>> * @return std::vector<std::shared_ptr<Node>>
*/ */
std::vector<NodePtr> getChildren(const IOIndex_t outId) const; std::vector<NodePtr> getChildren(const IOIndex_t outId) const;
...@@ -364,8 +364,8 @@ private: ...@@ -364,8 +364,8 @@ private:
/** /**
* @brief Set the idInChildren parameter. * @brief Set the idInChildren parameter.
* @param inID * @param inID
* @param newNodeOutID * @param newNodeOutID
*/ */
void setInputId(const IOIndex_t inID, const IOIndex_t newNodeOutID); void setInputId(const IOIndex_t inID, const IOIndex_t newNodeOutID);
...@@ -375,17 +375,17 @@ private: ...@@ -375,17 +375,17 @@ private:
/** /**
* @brief Add the given Node as a child for the current Node. * @brief Add the given Node as a child for the current Node.
* @param otherNode * @param otherNode
* @param outId * @param outId
* @param otherInId * @param otherInId
*/ */
void addChildOp(NodePtr otherNode, const IOIndex_t outId, void addChildOp(NodePtr otherNode, const IOIndex_t outId,
const IOIndex_t otherInId); const IOIndex_t otherInId);
/** /**
* @brief Add the given GraphView's input Node as a child for the current Node * @brief Add the given GraphView's input Node as a child for the current Node
* @param otherGraph * @param otherGraph
* @param outId * @param outId
* @param otherInId pointer the GraphView's input Node and its input index. Defaults to the * @param otherInId pointer the GraphView's input Node and its input index. Defaults to the
* only input Node if the GraphView has got one. * only input Node if the GraphView has got one.
*/ */
...@@ -402,4 +402,4 @@ private: ...@@ -402,4 +402,4 @@ private:
}; };
} // namespace Aidge } // namespace Aidge
#endif /* __AIDGE_CORE_GRAPH_NODE_H__ */ #endif /* AIDGE_CORE_GRAPH_NODE_H_ */
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_CORE_GRAPH_OPARGS_H__ #ifndef AIDGE_CORE_GRAPH_OPARGS_H_
#define __AIDGE_CORE_GRAPH_OPARGS_H__ #define AIDGE_CORE_GRAPH_OPARGS_H_
#include <memory> #include <memory>
#include <cassert> #include <cassert>
...@@ -30,7 +30,7 @@ private: ...@@ -30,7 +30,7 @@ private:
public: public:
OpArgs(const std::shared_ptr<GraphView>& view_) OpArgs(const std::shared_ptr<GraphView>& view_)
: mView(view_) {assert(mView && "The GraphView provided should not be a nullptr.");} : mView(view_) {assert(mView && "The GraphView provided should not be a nullptr.");}
OpArgs(const std::shared_ptr<Node>& node_) OpArgs(const std::shared_ptr<Node>& node_)
: mNode(node_) {assert(mNode && "The Node provided should not be a nullptr.");} : mNode(node_) {assert(mNode && "The Node provided should not be a nullptr.");}
...@@ -83,4 +83,4 @@ std::shared_ptr<GraphView> Residual(std::initializer_list<OpArgs> inputs); ...@@ -83,4 +83,4 @@ std::shared_ptr<GraphView> Residual(std::initializer_list<OpArgs> inputs);
} }
#endif /* __AIDGE_CORE_GRAPH_OPARGS_H__ */ #endif /* AIDGE_CORE_GRAPH_OPARGS_H_ */
\ No newline at end of file \ No newline at end of file
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_GREGEX_H__ #ifndef AIDGE_GREGEX_H_
#define __AIDGE_GREGEX_H__ #define AIDGE_GREGEX_H_
#include <stdexcept> // for exception, runtime_error, out_of_range #include <stdexcept> // for exception, runtime_error, out_of_range
#include <regex> #include <regex>
...@@ -43,7 +43,7 @@ public: ...@@ -43,7 +43,7 @@ public:
bool walk_validation_all_node_read_validate_by_one_stm(const std::vector<std::vector<SeqStm*>> all_stm); bool walk_validation_all_node_read_validate_by_one_stm(const std::vector<std::vector<SeqStm*>> all_stm);
bool walk_validation_common_nodes_same_tag_for_all_stm(const std::vector<std::vector<SeqStm*>> all_stm); bool walk_validation_common_nodes_same_tag_for_all_stm(const std::vector<std::vector<SeqStm*>> all_stm);
std::set<NodeTmp> get_all_validate_nodes(const std::vector<std::vector<SeqStm*>> all_stm); std::set<NodeTmp> get_all_validate_nodes(const std::vector<std::vector<SeqStm*>> all_stm);
std::vector<SeqStm*> getStmInit() const { std::vector<SeqStm*> getStmInit() const {
...@@ -53,11 +53,11 @@ public: ...@@ -53,11 +53,11 @@ public:
StmFactory getStmFab() const { StmFactory getStmFab() const {
return mStmFab; return mStmFab;
} }
//std::set<std::pair<std::vector<NodeTmp>,std::set<NodeTmp>>> match(const std::shared_ptr<GraphView> graphToMatch); //std::set<std::pair<std::vector<NodeTmp>,std::set<NodeTmp>>> match(const std::shared_ptr<GraphView> graphToMatch);
Match match(const std::shared_ptr<GraphView> graphToMatch); Match match(const std::shared_ptr<GraphView> graphToMatch);
}; };
} }
#endif //__AIDGE_GREGEX_H__ #endif //AIDGE_GREGEX_H_
\ No newline at end of file \ No newline at end of file
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_MATCH_H__ #ifndef AIDGE_MATCH_H_
#define __AIDGE_MATCH_H__ #define AIDGE_MATCH_H_
#include <vector> #include <vector>
#include <set> #include <set>
...@@ -41,4 +41,4 @@ protected: ...@@ -41,4 +41,4 @@ protected:
}; };
} }
#endif //__AIDGE_MATCH_H__ #endif //AIDGE_MATCH_H_
\ No newline at end of file \ No newline at end of file
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_NODEREGEX_H__ #ifndef AIDGE_NODEREGEX_H_
#define __AIDGE_NODEREGEX_H__ #define AIDGE_NODEREGEX_H_
#include <cstdlib> #include <cstdlib>
#include <iostream> #include <iostream>
#include <cstring> #include <cstring>
...@@ -27,7 +27,7 @@ class NodeRegex ...@@ -27,7 +27,7 @@ class NodeRegex
NodeRegex(const std::string c){ NodeRegex(const std::string c){
mCondition = c; mCondition = c;
}; };
// Version 1 - Only test the type of the node (no need for a lexer) // Version 1 - Only test the type of the node (no need for a lexer)
// Input : Node_op // Input : Node_op
// Output : bool // Output : bool
...@@ -38,4 +38,4 @@ class NodeRegex ...@@ -38,4 +38,4 @@ class NodeRegex
} }
#endif /* ___AIDGE_NODEREGEX_H___ */ #endif /* _AIDGE_NODEREGEX_H__ */
\ No newline at end of file \ No newline at end of file
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_SEQSTM_H__ #ifndef AIDGE_SEQSTM_H_
#define __AIDGE_SEQSTM_H__ #define AIDGE_SEQSTM_H_
#include <iostream> #include <iostream>
#include <map> #include <map>
...@@ -124,4 +124,4 @@ public: ...@@ -124,4 +124,4 @@ public:
}; };
} // namespace Aidge } // namespace Aidge
#endif /* __AIDGE_SEQSTM_H__ */ #endif /* AIDGE_SEQSTM_H_ */
\ No newline at end of file \ No newline at end of file
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_STMFACTORY_H__ #ifndef AIDGE_STMFACTORY_H_
#define __AIDGE_STMFACTORY_H__ #define AIDGE_STMFACTORY_H_
#include <map> #include <map>
#include <utility> #include <utility>
...@@ -52,4 +52,4 @@ private: ...@@ -52,4 +52,4 @@ private:
}; };
} }
#endif //__AIDGE_STMFACTORY_H__ #endif //AIDGE_STMFACTORY_H_
\ No newline at end of file \ No newline at end of file
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_CORE_OPERATOR_ADD_H__ #ifndef AIDGE_CORE_OPERATOR_ADD_H_
#define __AIDGE_CORE_OPERATOR_ADD_H__ #define AIDGE_CORE_OPERATOR_ADD_H_
#include <numeric> #include <numeric>
#include <vector> #include <vector>
...@@ -94,7 +94,7 @@ public: ...@@ -94,7 +94,7 @@ public:
return *(mInputs[inputIdx].get()); return *(mInputs[inputIdx].get());
} }
inline Tensor& output(__attribute__((unused)) const IOIndex_t outputIdx) const override final { return *(mOutput.get()); } inline Tensor& output(__attribute__((unused)) const IOIndex_t outputIdx) const override final { return *(mOutput.get()); }
inline std::shared_ptr<Tensor> getInput(const IOIndex_t inputIdx) const override final { inline std::shared_ptr<Tensor> getInput(const IOIndex_t inputIdx) const override final {
assert(static_cast<std::size_t>(inputIdx) < NUM && "wrong inputIdx for Add operator."); assert(static_cast<std::size_t>(inputIdx) < NUM && "wrong inputIdx for Add operator.");
return mInputs[inputIdx]; return mInputs[inputIdx];
...@@ -144,4 +144,4 @@ inline std::shared_ptr<Node> Add(const char* name = nullptr) { ...@@ -144,4 +144,4 @@ inline std::shared_ptr<Node> Add(const char* name = nullptr) {
} }
} }
#endif /* __AIDGE_CORE_OPERATOR_ADD_H__ */ #endif /* AIDGE_CORE_OPERATOR_ADD_H_ */
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_CORE_OPERATOR_AVGPOOLING_H__ #ifndef AIDGE_CORE_OPERATOR_AVGPOOLING_H_
#define __AIDGE_CORE_OPERATOR_AVGPOOLING_H__ #define AIDGE_CORE_OPERATOR_AVGPOOLING_H_
#include <array> #include <array>
#include <numeric> #include <numeric>
...@@ -46,7 +46,7 @@ public: ...@@ -46,7 +46,7 @@ public:
AvgPooling_Op() = delete; AvgPooling_Op() = delete;
using Parameterizable_ = Parameterizable<AvgPoolingParam, using Parameterizable_ = Parameterizable<AvgPoolingParam,
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<<1)> >; std::array<DimSize_t, (DIM<<1)> >;
template <AvgPoolingParam e> template <AvgPoolingParam e>
...@@ -76,7 +76,7 @@ public: ...@@ -76,7 +76,7 @@ public:
for (std::size_t dim = 0; dim < this->template get<AvgPoolingParam::KernelDims>().size() ; ++dim) { for (std::size_t dim = 0; dim < this->template get<AvgPoolingParam::KernelDims>().size() ; ++dim) {
outputDims[dim+2] = 1 + static_cast<DimSize_t>( outputDims[dim+2] = 1 + static_cast<DimSize_t>(
std::floor(static_cast<float>(mInput->dims()[dim+2] - std::floor(static_cast<float>(mInput->dims()[dim+2] -
this->template get<AvgPoolingParam::KernelDims>()[dim] + this->template get<AvgPoolingParam::KernelDims>()[dim] +
this->template get<AvgPoolingParam::PaddingDims>()[dim] + this->template get<AvgPoolingParam::PaddingDims>()[dim] +
this->template get<AvgPoolingParam::PaddingDims>()[dim+DIM]) / this->template get<AvgPoolingParam::PaddingDims>()[dim+DIM]) /
...@@ -166,4 +166,4 @@ const char *const EnumStrings<Aidge::AvgPoolingParam>::data[] = {"StrideDims", ...@@ -166,4 +166,4 @@ const char *const EnumStrings<Aidge::AvgPoolingParam>::data[] = {"StrideDims",
"KernelDims", "PaddingDims"}; "KernelDims", "PaddingDims"};
} }
#endif /* __AIDGE_CORE_OPERATOR_AVGPOOLING_H__ */ #endif /* AIDGE_CORE_OPERATOR_AVGPOOLING_H_ */
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_CORE_OPERATOR_BATCHNORM_H__ #ifndef AIDGE_CORE_OPERATOR_BATCHNORM_H_
#define __AIDGE_CORE_OPERATOR_BATCHNORM_H__ #define AIDGE_CORE_OPERATOR_BATCHNORM_H_
#include <array> #include <array>
#include <memory> #include <memory>
...@@ -53,7 +53,7 @@ public: ...@@ -53,7 +53,7 @@ public:
Parameterizable_(param<BatchNormParam::Epsilon>(epsilon), Parameterizable_(param<BatchNormParam::Epsilon>(epsilon),
param<BatchNormParam::Momentum>(momentum)), param<BatchNormParam::Momentum>(momentum)),
mOutput(std::make_shared<Tensor>()) { mOutput(std::make_shared<Tensor>()) {
setDatatype(DataType::Float32); setDatatype(DataType::Float32);
} }
// Data operator[](const char* inputName) override final { // Data operator[](const char* inputName) override final {
...@@ -158,4 +158,4 @@ template <> ...@@ -158,4 +158,4 @@ template <>
const char *const EnumStrings<Aidge::BatchNormParam>::data[] = { "Epsilon", "Momentum" }; const char *const EnumStrings<Aidge::BatchNormParam>::data[] = { "Epsilon", "Momentum" };
} }
#endif // __AIDGE_CORE_OPERATOR_BATCHNORM_H__ #endif //AIDGE_CORE_OPERATOR_BATCHNORM_H_
\ No newline at end of file \ No newline at end of file
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_CORE_OPERATOR_CONV_H__ #ifndef AIDGE_CORE_OPERATOR_CONV_H_
#define __AIDGE_CORE_OPERATOR_CONV_H__ #define AIDGE_CORE_OPERATOR_CONV_H_
#include <array> #include <array>
#include <cmath> #include <cmath>
...@@ -63,7 +63,7 @@ public: ...@@ -63,7 +63,7 @@ public:
param<ConvParam::KernelDims>(kernel_dims), param<ConvParam::KernelDims>(kernel_dims),
param<ConvParam::PaddingDims>(padding_dims)), param<ConvParam::PaddingDims>(padding_dims)),
mOutput(std::make_shared<Tensor>()) { mOutput(std::make_shared<Tensor>()) {
setDatatype(DataType::Float32); setDatatype(DataType::Float32);
} }
// Data operator[](const char* inputName) override final { // Data operator[](const char* inputName) override final {
...@@ -161,7 +161,7 @@ public: ...@@ -161,7 +161,7 @@ public:
}; };
template <std::array<DimSize_t, 1>::size_type DIM> template <std::array<DimSize_t, 1>::size_type DIM>
inline std::shared_ptr<Node> Conv(DimSize_t in_channels, inline std::shared_ptr<Node> Conv(DimSize_t in_channels,
DimSize_t out_channels, DimSize_t out_channels,
const std::array<DimSize_t, DIM> &kernel_dims, const std::array<DimSize_t, DIM> &kernel_dims,
const char *name = nullptr, const char *name = nullptr,
...@@ -197,4 +197,4 @@ const char *const EnumStrings<Aidge::ConvParam>::data[] = {"StrideDims", "Dilati ...@@ -197,4 +197,4 @@ const char *const EnumStrings<Aidge::ConvParam>::data[] = {"StrideDims", "Dilati
"KernelDims", "PaddingDims"}; "KernelDims", "PaddingDims"};
} }
#endif /* __AIDGE_CORE_OPERATOR_CONV_H__ */ #endif /* AIDGE_CORE_OPERATOR_CONV_H_ */
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_CORE_OPERATOR_CONVDEPTHWISE_H__ #ifndef AIDGE_CORE_OPERATOR_CONVDEPTHWISE_H_
#define __AIDGE_CORE_OPERATOR_CONVDEPTHWISE_H__ #define AIDGE_CORE_OPERATOR_CONVDEPTHWISE_H_
#include <array> #include <array>
#include <cmath> #include <cmath>
...@@ -49,9 +49,9 @@ class ConvDepthWise_Op : public Operator, ...@@ -49,9 +49,9 @@ class ConvDepthWise_Op : public Operator,
ConvDepthWise_Op() = delete; ConvDepthWise_Op() = delete;
using Parameterizable_ = Parameterizable<ConvDepthWiseParam, using Parameterizable_ = Parameterizable<ConvDepthWiseParam,
std::array<DimSize_t, DIM>,
std::array<DimSize_t, DIM>, std::array<DimSize_t, DIM>,
DimSize_t, std::array<DimSize_t, DIM>,
DimSize_t,
std::array<DimSize_t, DIM>, std::array<DimSize_t, DIM>,
std::array<DimSize_t, (DIM<<1) >>; std::array<DimSize_t, (DIM<<1) >>;
template <ConvDepthWiseParam e> template <ConvDepthWiseParam e>
...@@ -62,7 +62,7 @@ class ConvDepthWise_Op : public Operator, ...@@ -62,7 +62,7 @@ class ConvDepthWise_Op : public Operator,
const std::array<DimSize_t, (DIM<<1)> &padding_dims = create_array<DimSize_t,(DIM<<1)>(0), const std::array<DimSize_t, (DIM<<1)> &padding_dims = create_array<DimSize_t,(DIM<<1)>(0),
const std::array<DimSize_t, DIM> &dilation_dims = create_array<DimSize_t,DIM>(1)) const std::array<DimSize_t, DIM> &dilation_dims = create_array<DimSize_t,DIM>(1))
: Operator(Type), : Operator(Type),
Parameterizable_(param<ConvDepthWiseParam::StrideDims>(stride_dims), Parameterizable_(param<ConvDepthWiseParam::StrideDims>(stride_dims),
param<ConvDepthWiseParam::DilationDims>(dilation_dims), param<ConvDepthWiseParam::DilationDims>(dilation_dims),
param<ConvDepthWiseParam::Channels>(0), param<ConvDepthWiseParam::Channels>(0),
param<ConvDepthWiseParam::KernelDims>(kernel_dims), param<ConvDepthWiseParam::KernelDims>(kernel_dims),
...@@ -130,7 +130,7 @@ class ConvDepthWise_Op : public Operator, ...@@ -130,7 +130,7 @@ class ConvDepthWise_Op : public Operator,
std::shared_ptr<Data> getRawInput(const IOIndex_t inputIdx) const override final { std::shared_ptr<Data> getRawInput(const IOIndex_t inputIdx) const override final {
assert(inputIdx < 3 && "operators supports only 3 inputs"); assert(inputIdx < 3 && "operators supports only 3 inputs");
return std::static_pointer_cast<Data>(mInputs[inputIdx]); return std::static_pointer_cast<Data>(mInputs[inputIdx]);
} }
std::shared_ptr<Data> getRawOutput(__attribute__((unused)) const IOIndex_t outputIdx) const override final { std::shared_ptr<Data> getRawOutput(__attribute__((unused)) const IOIndex_t outputIdx) const override final {
assert(outputIdx == 0 && "operator supports only 1 output"); assert(outputIdx == 0 && "operator supports only 1 output");
return std::static_pointer_cast<Data>(mOutput); return std::static_pointer_cast<Data>(mOutput);
...@@ -193,4 +193,4 @@ const char *const EnumStrings<Aidge::ConvDepthWiseParam>::data[] = {"StrideDims" ...@@ -193,4 +193,4 @@ const char *const EnumStrings<Aidge::ConvDepthWiseParam>::data[] = {"StrideDims"
"KernelDims", "PaddingDims"}; "KernelDims", "PaddingDims"};
} }
#endif /* __AIDGE_CORE_OPERATOR_CONVDEPTHWISE_H__ */ #endif /* AIDGE_CORE_OPERATOR_CONVDEPTHWISE_H_ */
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* *
********************************************************************************/ ********************************************************************************/
#ifndef __AIDGE_CORE_OPERATOR_FC_H__ #ifndef AIDGE_CORE_OPERATOR_FC_H_
#define __AIDGE_CORE_OPERATOR_FC_H__ #define AIDGE_CORE_OPERATOR_FC_H_
#include <array> #include <array>
#include <cmath> #include <cmath>
...@@ -75,7 +75,7 @@ public: ...@@ -75,7 +75,7 @@ public:
std::array<DimSize_t, 2> weightDims = {this->template get<FCParam::OutChannels>(), static_cast<DimSize_t>(mInputs[0]->sizeM1())}; std::array<DimSize_t, 2> weightDims = {this->template get<FCParam::OutChannels>(), static_cast<DimSize_t>(mInputs[0]->sizeM1())};
// <out_channels, batch> // <out_channels, batch>
std::array<DimSize_t, 2> outputDims = {mInputs[0]->dims()[0], this->template get<FCParam::OutChannels>()}; std::array<DimSize_t, 2> outputDims = {mInputs[0]->dims()[0], this->template get<FCParam::OutChannels>()};
mInputs[1]->resize(weightDims); mInputs[1]->resize(weightDims);
mOutput->resize(outputDims); mOutput->resize(outputDims);
} }
...@@ -152,4 +152,4 @@ const char *const EnumStrings<Aidge::FCParam>::data[] = {"OutChannels", ...@@ -152,4 +152,4 @@ const char *const EnumStrings<Aidge::FCParam>::data[] = {"OutChannels",
"NoBias"}; "NoBias"};
} }
#endif /* __AIDGE_CORE_OPERATOR_FC_H__ */ #endif /* AIDGE_CORE_OPERATOR_FC_H_ */
\ No newline at end of file \ No newline at end of file
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