This patch updates the getStringDataType function structure to utilize method overriding.
**Self-evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: Donghyeon Jeong <dhyeon.jeong@samsung.com>
const float *, float *)>
v_func,
Tensor &output) const;
+
+ /**
+ * @brief Get the Data Type String object
+ * @return std::string of tensor data type (FP32)
+ */
+ std::string getStringDataType() const override { return "FP32"; }
};
} // namespace nntrainer
const _FP16 *, _FP16 *)>
v_func,
Tensor &output) const;
+
+ /**
+ * @brief Get the Data Type String object
+ * @return std::string of tensor data type (FP16)
+ */
+ std::string getStringDataType() const override { return "FP16"; }
};
} // namespace nntrainer
/**
* @brief Get the Data Type String object
* @return std::string of tensor data type
+ * @note TensorBase::getStringDataType() should not be called. Please define
+ * this function in the derived class to the corresponding data type.
*/
- std::string getStringDataType() const {
- std::string res;
- switch (getDataType()) {
- case Tdatatype::FP32:
- res = "FP32";
- break;
- case Tdatatype::FP16:
- res = "FP16";
- break;
- case Tdatatype::QINT8:
- res = "QINT8";
- break;
- case Tdatatype::QINT4:
- res = "QINT4";
- break;
- default:
- res = "Undefined type";
- break;
- }
- return res;
- }
+ virtual std::string getStringDataType() const { return "Undefined type"; }
};
/**