{
return session->set_output(index, type, buffer, length);
}
+
+/*
+ * Get the number of inputs
+ *
+ * @param[in] session session from input information is to be extracted
+ * @param[out] number variable which the number of inputs is put into
+ *
+ * @return NNFW_STATUS_NO_ERROR if successful
+ */
+
+NNFW_STATUS nnfw_input_size(nnfw_session *session, uint32_t *number)
+{
+ return session->input_size(number);
+}
+
+/*
+ * Get the number of outputs
+ *
+ * @param[in] session session from output information is to be extracted
+ * @param[out] number variable which the number of outputs is put into
+ *
+ * @return NNFW_STATUS_NO_ERROR if successful
+ */
+NNFW_STATUS nnfw_output_size(nnfw_session *session, uint32_t *number)
+{
+ return session->output_size(number);
+}
#include <iostream>
#include <string>
#include <dirent.h>
+#include <limits.h>
+#include <stdint.h>
nnfw_session::nnfw_session() : _graph{nullptr}, _execution{nullptr}
{
}
return NNFW_STATUS_NO_ERROR;
}
+
+NNFW_STATUS nnfw_session::input_size(uint32_t *number)
+{
+ try
+ {
+ if (number == nullptr)
+ {
+ std::cerr << "Error during nnfw_session::input_size, number is null pointer." << std::endl;
+ return NNFW_STATUS_ERROR;
+ }
+ uint32_t sz = _graph->getInputs().size();
+ *number = sz;
+ }
+ catch (...)
+ {
+ std::cerr << "Error during nnfw_session::input_size" << std::endl;
+ return NNFW_STATUS_ERROR;
+ }
+ return NNFW_STATUS_NO_ERROR;
+}
+
+NNFW_STATUS nnfw_session::output_size(uint32_t *number)
+{
+ try
+ {
+ if (number == nullptr)
+ {
+ std::cerr << "Error during nnfw_session::output_size, number is null pointer." << std::endl;
+ return NNFW_STATUS_ERROR;
+ }
+ uint32_t sz = _graph->getOutputs().size();
+ *number = sz;
+ }
+ catch (...)
+ {
+ std::cerr << "Error during nnfw_session::output_size" << std::endl;
+ return NNFW_STATUS_ERROR;
+ }
+ return NNFW_STATUS_NO_ERROR;
+}
NNFW_STATUS set_input(uint32_t index, NNFW_TYPE type, const void *buffer, size_t length);
NNFW_STATUS set_output(uint32_t index, NNFW_TYPE type, void *buffer, size_t length);
+ NNFW_STATUS input_size(uint32_t *number);
+ NNFW_STATUS output_size(uint32_t *number);
+
private:
std::shared_ptr<neurun::graph::Graph> _graph;
std::shared_ptr<neurun::exec::Execution> _execution;