Skip to content
Snippets Groups Projects
Commit d269bd05 authored by Olivier BICHLER's avatar Olivier BICHLER
Browse files

Merge branch 'main' of gitlab.eclipse.org:eclipse/aidge/aidge_core

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