Weight did not have copy/move ctor which they should have.
This patch adds them.
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
}
/**
+ * @brief Copy constructor for weight
+ *
+ * @param rhs weight to construct from
+ */
+ Weight(const Weight &rhs);
+
+ /**
+ * @brief Move constructor for weight
+ *
+ * @param rhs weight to construct from
+ */
+ Weight(Weight &&rhs) = default;
+
+ /**
* @brief copy assigment
*
* @param rhs copy from
* @return Weight& Updated weight
*/
- Weight &operator=(const Weight &rhs) = default;
+ Weight &operator=(const Weight &rhs);
/**
* @brief move assignment
namespace nntrainer {
+Weight::Weight(const Weight &rhs) :
+ initializer(rhs.initializer),
+ trainable(rhs.trainable),
+ name(rhs.name) {
+ var = rhs.var.clone();
+ grad = rhs.grad.clone();
+}
+
+Weight &Weight::operator=(const Weight &rhs) {
+ Weight temp(rhs);
+ swap(temp, *this);
+ return *this;
+}
+
Weight::Weight(const TensorDim &dim, const WeightInitializer init, bool train,
std::string name) :
initializer(init),