Skip to content
Snippets Groups Projects

[Add] Dropout Operator

Merged Marwa ABDELOUINISSE requested to merge maab05/aidge_core:feat_183_add_dropout into dev
Compare and
9 files
+ 316
46
Compare changes
  • Side-by-side
  • Inline
Files
9
@@ -108,6 +108,8 @@ public:
*/
Clip_Op(const Clip_Op& op);
virtual ~Clip_Op() noexcept;
/**
* @brief Clone the operator using its copy constructor.
* @return A shared pointer to the cloned operator.
@@ -140,41 +142,13 @@ public:
* @brief Getter for the minimum clipping value.
* @return Reference to the minimum value.
*/
inline float& min() const noexcept {
if (getInput(1)){
if (getInput(1)->size() > 1)
AIDGE_THROW_OR_ABORT(std::runtime_error, "Expected Input#1 to be scalar (Tensors of empty shapes or of size one)");
std::shared_ptr<Tensor> fallback;
const auto& minTensor = mInputs[1]->refCastFrom(fallback, DataType::Float32, "cpu");
float minValue = *(static_cast<float*>(minTensor.getImpl()->hostPtr()));
if(mAttributes->getAttr<ClipAttr::Min>() != std::numeric_limits<float>::lowest() && mAttributes->getAttr<ClipAttr::Min>() != minValue)
Log::notice("{} : ignoring non-empty min attribute because input#1 take precedence", type());
mAttributes->getAttr<ClipAttr::Min>() = minValue;
}
return mAttributes->getAttr<ClipAttr::Min>();
}
float& min() const;
/**
* @brief Getter for the maximum clipping value.
* @return Reference to the maximum value.
*/
inline float& max() const noexcept {
if (getInput(2)){
if (getInput(2)->size() > 1)
AIDGE_THROW_OR_ABORT(std::runtime_error, "Expected Input#2 to be scalar (Tensors of empty shapes or of size one)");
std::shared_ptr<Tensor> fallback;
const auto& maxTensor = mInputs[2]->refCastFrom(fallback, DataType::Float32, "cpu");
float maxValue = *(static_cast<float*>(maxTensor.getImpl()->hostPtr()));
if(mAttributes->getAttr<ClipAttr::Max>() != std::numeric_limits<float>::max() && mAttributes->getAttr<ClipAttr::Max>() != maxValue)
Log::notice("{} : ignoring non-empty max attribute because input#2 take precedence", type());
mAttributes->getAttr<ClipAttr::Max>() = maxValue;
}
return mAttributes->getAttr<ClipAttr::Max>();
}
float& max() const;
std::set<std::string> getAvailableBackends() const override;
Loading