#include <app_context.h>
#include <layer.h>
-#include <layer_node.h>
+#include <layer_internal.h>
const char *NNTRAINER_PATH = std::getenv("NNTRAINER_PATH");
#include <iostream>
#include <sstream>
#include <stdlib.h>
-#include <tensor.h>
#include <time.h>
#include <dataset.h>
-#include <layer_node.h>
+#include <layer_internal.h>
#include <ml-api-common.h>
#include <neuralnet.h>
+#include <tensor.h>
std::string data_file;
#include <memory>
#include <app_context.h>
-#include <layer_node.h>
+#include <layer_internal.h>
#include <manager.h>
#include <nntrainer_test_util.h>
#include <memory>
#include <app_context.h>
-#include <layer_node.h>
+#include <layer_internal.h>
#include <manager.h>
#include <nntrainer_test_util.h>
return ML_ERROR_NOT_SUPPORTED;
}
- /// TODO: the last entry in adj and sorted are not same
- adj.pop_back();
Sorted.pop_back();
+ adj.erase(adj.begin() + last_node->getIndex());
switch (last_node->getObject()->getActivationType()) {
case ActivationType::ACT_SIGMOID:
}
}
- /// @note this assumes that loss layer only supports single input
last_node = Sorted.back();
- /// TODO: need to find all the nodes whose entry matches with node remove and
- /// update them all
+ /**
+ * Remove all the connections for the current lasy layer as it will now only
+ * connect with the new loss layer to be added.
+ * @note this assumes that loss layer only supports single input
+ */
if (updated_loss_type == LossType::LOSS_ENTROPY_SIGMOID ||
updated_loss_type == LossType::LOSS_ENTROPY_SOFTMAX)
adj[last_node->getIndex()].resize(1);
#include <sstream>
#include <layer_internal.h>
+#include <layer_node.h>
#include <nntrainer_error.h>
#include <nntrainer_log.h>
#include <parse_util.h>
}
};
+std::shared_ptr<Layer> getLayerDevel(std::shared_ptr<ml::train::Layer> l) {
+ return std::static_pointer_cast<LayerNode>(l)->getObject();
+}
+
} /* namespace nntrainer */
return ptr;
}
+/**
+ * @brief Get Layer devel from ml::train::Layer
+ *
+ * @param l Layer object
+ * @return Layer devel object
+ */
+std::shared_ptr<Layer> getLayerDevel(std::shared_ptr<ml::train::Layer> l);
+
} // namespace nntrainer
#endif /* __cplusplus */
#include <layer_node.h>
-namespace nntrainer {
-
-std::shared_ptr<Layer> getLayerDevel(std::shared_ptr<ml::train::Layer> l) {
- std::shared_ptr<LayerNode> lnode = std::static_pointer_cast<LayerNode>(l);
-
- std::shared_ptr<Layer> &layer = lnode->getObject();
-
- return layer;
-}
-
-}; // namespace nntrainer
+namespace nntrainer {}; // namespace nntrainer
activation_type; /**< activation applied to the output of this node */
};
-/**
- * @brief Get Layer devel from ml::train::Layer
- *
- * @param l Layer object
- * @return Layer devel object
- */
-std::shared_ptr<Layer> getLayerDevel(std::shared_ptr<ml::train::Layer> l);
-
} // namespace nntrainer
#endif // __LAYER_NODE_H__
auto graph = std::make_shared<nntrainer::GraphRepresentation>();
for (const auto &layer_representation : layer_reps) {
+ /// @todo Use unique_ptr here
std::shared_ptr<nntrainer::Layer> nntr_layer =
ac.createObject<nntrainer::Layer>(layer_representation.first,
layer_representation.second);
std::vector<NodeType> graph = model_graph.getSorted();
for (auto it = graph.begin(); it != graph.end() - 1; ++it) {
- nodes.push_back(NodeWatcher((*it)));
+ nodes.push_back(NodeWatcher(*it));
}
loss_node = NodeWatcher(graph.back());