Skip to content
Snippets Groups Projects
Commit e2f9f441 authored by Houssem ROUIS's avatar Houssem ROUIS
Browse files

minor code cleanings

parent 71223519
No related branches found
No related tags found
2 merge requests!59Improvements and fixes,!47Vit operators
......@@ -64,7 +64,7 @@ public:
}
void associateInput(const IOIndex_t inputIdx, std::shared_ptr<Data> data) override final {
assert(inputIdx == 0 && "operator supports only 1 input");
assert(inputIdx == 0 && "Erf operator supports only 1 input");
(void) inputIdx; // avoid unused warning
assert(strcmp(data->type(), Tensor::Type)==0 && "input data must be of Tensor type");
mInput = std::dynamic_pointer_cast<Tensor>(data);
......@@ -85,24 +85,24 @@ public:
inline std::shared_ptr<Tensor> getInput(const IOIndex_t inputIdx) const override final {
assert((inputIdx == 0) && "Erf Operator has only 1 input");
assert((inputIdx == 0) && "Erf operator has only 1 input");
(void) inputIdx; // avoid unused warning
return mInput;
}
inline std::shared_ptr<Tensor> getOutput(const IOIndex_t outputIdx) const override final {
assert((outputIdx == 0) && "Erf Operator has only 1 output");
assert((outputIdx == 0) && "Erf operator has only 1 output");
(void) outputIdx; // avoid unused warning
return mOutput;
}
std::shared_ptr<Data> getRawInput(const IOIndex_t inputIdx) const override final {
assert(inputIdx == 0 && "operator supports only 1 input");
assert(inputIdx == 0 && "Erf operator supports only 1 input");
(void) inputIdx; // avoid unused warning
return std::static_pointer_cast<Data>(mInput);
}
std::shared_ptr<Data> getRawOutput(const IOIndex_t outputIdx) const override final {
assert(outputIdx == 0 && "operator supports only 1 output");
assert(outputIdx == 0 && "Erf operator supports only 1 output");
(void) outputIdx; // avoid unused warning
return std::static_pointer_cast<Data>(mOutput);
}
......
......@@ -79,7 +79,7 @@ public:
}
void associateInput(const IOIndex_t inputIdx, std::shared_ptr<Data> data) override final {
assert(inputIdx < 2 && "Gather supports only 2 inputs");
assert(inputIdx < 2 && "Gather operator supports only 2 inputs");
assert(strcmp(data->type(), Tensor::Type)==0 && "input data must be of Tensor type");
mInputs[inputIdx] = std::dynamic_pointer_cast<Tensor>(data);
}
......
......@@ -115,24 +115,24 @@ class ReduceMean_Op : public Operator,
inline std::shared_ptr<Tensor> getInput(const IOIndex_t inputIdx) const override final {
assert(inputIdx == 0 && "ReduceMean Operators supports only 1 input");
assert(inputIdx == 0 && "ReduceMean operators supports only 1 input");
(void) inputIdx; // avoid unused warning
return mInput;
}
inline std::shared_ptr<Tensor> getOutput(const IOIndex_t outputIdx) const override final {
assert((outputIdx == 0) && "ReduceMean Operator has only 1 output");
assert((outputIdx == 0) && "ReduceMean operator has only 1 output");
(void) outputIdx; // avoid unused warning
return mOutput;
}
std::shared_ptr<Data> getRawInput(const IOIndex_t inputIdx) const override final {
assert(inputIdx == 0 && "ReduceMean Operators supports only 1 input");
assert(inputIdx == 0 && "ReduceMean operators supports only 1 input");
(void) inputIdx; // avoid unused warning
return std::static_pointer_cast<Data>(mInput);
}
std::shared_ptr<Data> getRawOutput(const IOIndex_t outputIdx) const override final {
assert(outputIdx == 0 && "ReduceMean Operator supports only 1 output");
assert(outputIdx == 0 && "ReduceMean operator supports only 1 output");
(void) outputIdx; // avoid unused warning
return std::static_pointer_cast<Data>(mOutput);
}
......
......@@ -64,7 +64,7 @@ public:
}
void associateInput(const IOIndex_t inputIdx, std::shared_ptr<Data> data) override final {
assert(inputIdx < 2 && "Reshape Operator supports only 2 inputs");
assert(inputIdx < 2 && "Reshape operator supports only 2 inputs");
assert(strcmp(data->type(), Tensor::Type)==0 && "input data must be of Tensor type");
mInputs[inputIdx] = std::dynamic_pointer_cast<Tensor>(data);
}
......@@ -74,7 +74,7 @@ public:
{
std::vector<DimSize_t> outDims;
int* shapeElem = static_cast<int*>(mInputs[1]->getImpl()->rawPtr());
for(std::size_t i=0; i<mInputs[1]->nbDims(); ++i)
for(std::size_t i=0; i<mInputs[1]->size(); ++i)
{
outDims.push_back(shapeElem[i]);
}
......@@ -95,24 +95,24 @@ public:
inline std::shared_ptr<Tensor> getInput(const IOIndex_t inputIdx) const override final {
assert((inputIdx < 2) && "Reshape Operator has 2 inputs");
assert((inputIdx < 2) && "Reshape operator has 2 inputs");
(void) inputIdx; // avoid unused warning
return mInputs[inputIdx];
}
inline std::shared_ptr<Tensor> getOutput(const IOIndex_t outputIdx) const override final {
assert((outputIdx == 0) && "Reshape Operator has only 1 output");
assert((outputIdx == 0) && "Reshape operator has only 1 output");
(void) outputIdx; // avoid unused warning
return mOutput;
}
std::shared_ptr<Data> getRawInput(const IOIndex_t inputIdx) const override final {
assert(inputIdx < 2 && "Reshape Operator supports only 2 inputs");
assert(inputIdx < 2 && "Reshape operator supports only 2 inputs");
(void) inputIdx; // avoid unused warning
return std::static_pointer_cast<Data>(mInputs[inputIdx]);
}
std::shared_ptr<Data> getRawOutput(const IOIndex_t outputIdx) const override final {
assert(outputIdx == 0 && "Reshape Operator supports only 1 output");
assert(outputIdx == 0 && "Reshape operator supports only 1 output");
(void) outputIdx; // avoid unused warning
return std::static_pointer_cast<Data>(mOutput);
}
......
......@@ -11,7 +11,6 @@
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <iostream>
#include <string>
#include <vector>
#include <array>
......@@ -27,9 +26,6 @@ namespace Aidge {
template <DimIdx_t DIM> void declare_ReduceMeanOp(py::module &m) {
py::class_<ReduceMean_Op<DIM>, std::shared_ptr<ReduceMean_Op<DIM>>, Operator, Attributes>(
m, ("ReduceMeanOp" + std::to_string(DIM) + "D").c_str(), py::multiple_inheritance())
// .def(py::init<const std::array<DimSize_t, DIM> &, DimSize_t>(),
// py::arg("axes"),
// py::arg("keep_dims"))
.def("get_inputs_name", &ReduceMean_Op<DIM>::getInputsName)
.def("get_outputs_name", &ReduceMean_Op<DIM>::getOutputsName)
;
......
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