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

Change 'const char*' with 'const std::string' in every operator #2

parent 450f6c80
No related branches found
No related tags found
No related merge requests found
Showing
with 43 additions and 23 deletions
......@@ -30,7 +30,7 @@ namespace Aidge {
class Add_Op : public OperatorTensor,
public Registrable<Add_Op, std::string, std::unique_ptr<OperatorImpl>(const Add_Op&)> {
public:
static constexpr const char* Type = "Add";
static const std::string Type;
Add_Op(const IOIndex_t nbIn)
: OperatorTensor(Type, nbIn, 0, 1)
......@@ -86,10 +86,10 @@ public:
}
}
static const std::vector<std::string> getInputsName(){
static const std::vector<std::string> getInputsName() {
return {"data_input_0", "data_input_n"};
}
static const std::vector<std::string> getOutputsName(){
static const std::vector<std::string> getOutputsName() {
return {"data_output"};
}
};
......
......@@ -36,7 +36,7 @@ class AvgPooling_Op : public OperatorTensor,
std::array<DimSize_t, DIM>> {
public:
static constexpr const char *Type = "AvgPooling";
static const std::string Type;
AvgPooling_Op() = delete;
......@@ -146,6 +146,9 @@ public:
}
};
template <DimIdx_t DIM>
const std::string AvgPooling_Op<DIM>::Type = "AvgPooling";
template <std::array<DimSize_t, 1>::size_type DIM>
inline std::shared_ptr<Node> AvgPooling(const std::array<DimSize_t, DIM> &kernel_dims,
const std::string& name = "",
......
......@@ -33,7 +33,7 @@ class BatchNorm_Op : public OperatorTensor,
public Registrable<BatchNorm_Op<DIM>, std::string, std::unique_ptr<OperatorImpl>(const BatchNorm_Op<DIM> &)>,
public StaticAttributes<BatchNormAttr, float, float> {
public:
static constexpr const char *Type = "BatchNorm";
static const std::string Type;
BatchNorm_Op() = delete;
......@@ -113,6 +113,9 @@ public:
}
};
template <DimIdx_t DIM>
const std::string BatchNorm_Op<DIM>::Type = "BatchNorm";
template <DimSize_t DIM>
inline std::shared_ptr<Node> BatchNorm(const float epsilon = 1.0e-5F,
const float momentum = 0.1F,
......
......@@ -32,7 +32,7 @@ class Concat_Op : public OperatorTensor,
public Registrable<Concat_Op, std::string, std::unique_ptr<OperatorImpl>(const Concat_Op&)>,
public StaticAttributes<ConcatAttr, DimSize_t> {
public:
static constexpr const char* Type = "Concat";
static const std::string Type;
using Attributes_ = StaticAttributes<ConcatAttr, DimSize_t>;
template <ConcatAttr e>
......
......@@ -36,7 +36,7 @@ class Conv_Op : public OperatorTensor,
DimSize_t, std::array<DimSize_t, DIM>> {
public:
static constexpr const char *Type = "Conv";
static const std::string Type;
Conv_Op() = delete;
......@@ -186,6 +186,9 @@ public:
}
};
template <DimIdx_t DIM>
const std::string Conv_Op<DIM>::Type = "Conv";
template <std::array<DimSize_t, 1>::size_type DIM>
inline std::shared_ptr<Node> Conv(DimSize_t inChannels,
DimSize_t outChannels,
......
......@@ -37,7 +37,7 @@ class ConvDepthWise_Op : public OperatorTensor,
DimSize_t,
std::array<DimSize_t, DIM>> {
public:
static constexpr const char *Type = "ConvDepthWise";
static const std::string Type;
ConvDepthWise_Op() = delete;
......@@ -168,6 +168,9 @@ public:
}
};
template <DimIdx_t DIM>
const std::string ConvDepthWise_Op<DIM>::Type = "ConvDepthWise";
template <std::array<DimSize_t, 1>::size_type DIM>
inline std::shared_ptr<Node> ConvDepthWise(const DimSize_t nbChannels,
const std::array<DimSize_t, DIM> &kernelDims,
......
......@@ -29,7 +29,7 @@ class Div_Op : public OperatorTensor,
public Registrable<Div_Op, std::string, std::unique_ptr<OperatorImpl>(const Div_Op&)> {
public:
static constexpr const char* Type = "Div";
static const std::string Type;
Div_Op() : OperatorTensor(Type, 2, 0, 1) {}
......
......@@ -35,7 +35,7 @@ class FC_Op : public OperatorTensor,
std::unique_ptr<OperatorImpl>(const FC_Op &)>,
public StaticAttributes<FCAttr, DimSize_t, bool> {
public:
static constexpr const char* Type = "FC";
static const std::string Type;
FC_Op() = delete;
......
......@@ -36,7 +36,7 @@ private:
ComputeDimsFunc mComputeOutputDims;
public:
GenericOperator_Op(const char *type, IOIndex_t nbData, IOIndex_t nbParam, IOIndex_t nbOut)
GenericOperator_Op(const std::string& type, IOIndex_t nbData, IOIndex_t nbParam, IOIndex_t nbOut)
: OperatorTensor(type, nbData, nbParam, nbOut)
{}
......@@ -125,7 +125,7 @@ public:
* @param name (optional) name of the Operator.
* @return std::shared_ptr<Node> Node associated with the Generic Operator.
*/
inline std::shared_ptr<Node> GenericOperator(const char *type, IOIndex_t nbData, IOIndex_t nbParam, IOIndex_t nbOut,
inline std::shared_ptr<Node> GenericOperator(const std::string& type, IOIndex_t nbData, IOIndex_t nbParam, IOIndex_t nbOut,
const std::string& name = "") {
return std::make_shared<Node>(std::make_shared<GenericOperator_Op>(type, nbData, nbParam, nbOut), name);
}
......
......@@ -37,7 +37,7 @@ namespace Aidge {
class Identity_Op : public OperatorTensor,
public Registrable<Identity_Op, std::string, std::unique_ptr<OperatorImpl>(const Identity_Op&)> {
public:
static constexpr const char* Type = "Identity";
static const std::string Type;
Identity_Op()
: OperatorTensor(Type, 1, 0, 0)
......@@ -105,9 +105,11 @@ public:
}
void setBackend(const std::string& name) override final {
// setBackend do nothing, Identity node has no backend it just pass the same Tensor
(void) name;
}
void setDataType(const DataType& dataType) const override final {
// setDatatype do nothing, Identity node has no backend it just pass the same Tensor
(void) dataType;
}
static const std::vector<std::string> getInputsName(){
......
......@@ -33,7 +33,7 @@ class LeakyReLU_Op : public OperatorTensor,
public Registrable<LeakyReLU_Op, std::string, std::unique_ptr<OperatorImpl>(const LeakyReLU_Op&)>,
public StaticAttributes<LeakyReLUAttr, float> {
public:
static constexpr const char* Type = "LeakyReLU";
static const std::string Type;
LeakyReLU_Op() = delete;
......
......@@ -35,7 +35,7 @@ class MatMul_Op : public OperatorTensor,
std::unique_ptr<OperatorImpl>(const MatMul_Op &)>,
public StaticAttributes<MatMulAttr, DimSize_t> {
public:
static constexpr const char* Type = "MatMul";
static const std::string Type;
MatMul_Op() = delete;
......
......@@ -36,7 +36,7 @@ class MaxPooling_Op : public OperatorTensor,
std::array<DimSize_t, DIM>,
bool> {
public:
static constexpr const char *Type = "MaxPooling";
static const std::string Type;
MaxPooling_Op() = delete;
......@@ -120,6 +120,9 @@ public:
}
};
template <DimIdx_t DIM>
const std::string MaxPooling_Op<DIM>::Type = "MaxPooling";
template <std::array<DimSize_t, 1>::size_type DIM>
inline std::shared_ptr<Node> MaxPooling(const std::array<DimSize_t, DIM> &kernel_dims,
const std::string& name = "",
......
......@@ -31,7 +31,7 @@ namespace Aidge {
class Mul_Op : public OperatorTensor,
public Registrable<Mul_Op, std::string, std::unique_ptr<OperatorImpl>(const Mul_Op&)> {
public:
static constexpr const char* Type = "Mul";
static const std::string Type;
Mul_Op() : OperatorTensor(Type, 2, 0, 1) {}
......
......@@ -44,7 +44,7 @@ private:
public:
Operator() = delete;
Operator(const char* type, const IOIndex_t nbData, const IOIndex_t nbParam, const IOIndex_t nbOut, const OperatorType operatorType = OperatorType::Data)
Operator(const std::string& type, const IOIndex_t nbData, const IOIndex_t nbParam, const IOIndex_t nbOut, const OperatorType operatorType = OperatorType::Data)
: mType(type),
mOperatorType(operatorType),
mNbData(nbData),
......
......@@ -40,7 +40,7 @@ protected:
public:
OperatorTensor() = delete;
OperatorTensor(const char* type, const IOIndex_t nbData, const IOIndex_t nbParam,
OperatorTensor(const std::string& type, const IOIndex_t nbData, const IOIndex_t nbParam,
const IOIndex_t nbOut)
: Operator(type, nbData, nbParam, nbOut, OperatorType::Tensor),
mInputs(std::vector<std::shared_ptr<Tensor>>(nbData + nbParam, nullptr)),
......
......@@ -37,7 +37,7 @@ class Pad_Op : public OperatorTensor,
PadBorderType,
double> {
public:
static constexpr const char *Type = "Pad";
static const std::string Type;
Pad_Op() = delete;
......@@ -113,6 +113,9 @@ public:
}
};
template <DimIdx_t DIM>
const std::string Pad_Op<DIM>::Type = "Pad";
template <std::array<DimSize_t, 1>::size_type DIM>
inline std::shared_ptr<Node> Pad(const std::array<DimSize_t, 2*DIM> &beginEndTuples,
const std::string& name = "",
......
......@@ -29,7 +29,7 @@ namespace Aidge {
class Pow_Op : public OperatorTensor,
public Registrable<Pow_Op, std::string, std::unique_ptr<OperatorImpl>(const Pow_Op&)> {
public:
static constexpr const char* Type = "Pow";
static const std::string Type;
Pow_Op() : OperatorTensor(Type, 2, 0, 1) {}
......
......@@ -29,7 +29,7 @@ class Producer_Op
public Registrable<Producer_Op, std::string, std::unique_ptr<OperatorImpl>(
const Producer_Op &)> {
public:
static constexpr const char* Type = "Producer";
static const std::string Type;
template <std::size_t DIM>
Producer_Op(const std::array<DimSize_t, DIM>& dims)
......
......@@ -28,7 +28,7 @@ namespace Aidge {
class ReLU_Op : public OperatorTensor,
public Registrable<ReLU_Op, std::string, std::unique_ptr<OperatorImpl>(const ReLU_Op&)> {
public:
static constexpr const char* Type = "ReLU";
static const std::string Type;
ReLU_Op() : OperatorTensor(Type, 1, 0, 1) {}
......
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