From 445ba9c12b397c90a2457df0b642b65d7a56a3b2 Mon Sep 17 00:00:00 2001 From: cmoineau <cyril.moineau@cea.fr> Date: Tue, 1 Apr 2025 08:14:02 +0000 Subject: [PATCH] Add forwardDType to Cast operator. --- include/aidge/operator/Cast.hpp | 6 ++++++ src/operator/Cast.cpp | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/include/aidge/operator/Cast.hpp b/include/aidge/operator/Cast.hpp index cd37e47d8..2adbcad33 100644 --- a/include/aidge/operator/Cast.hpp +++ b/include/aidge/operator/Cast.hpp @@ -98,6 +98,12 @@ public: */ Cast_Op(const Cast_Op& op); + /** + * @brief Forward the data type. + * @return True if successful, false otherwise. + */ + bool forwardDType() override final; + /** * @brief Clone the operator using its copy constructor. * @return A shared pointer to the cloned operator. diff --git a/src/operator/Cast.cpp b/src/operator/Cast.cpp index 128868dcd..587310c06 100644 --- a/src/operator/Cast.cpp +++ b/src/operator/Cast.cpp @@ -49,6 +49,11 @@ Cast_Op::Cast_Op(const Cast_Op& op) } } +bool Aidge::Cast_Op::forwardDType(){ + mOutputs[0]->setDataType(mAttributes->getAttr<CastAttr::TargetType>()); + return true; +} + void Aidge::Cast_Op::setDataType(const DataType& dataType) const { if (targetType() != dataType) { Log::warn("Cast::setDataType(): Cannot setDataType for cast operator."); -- GitLab