*/
unsigned int parseOptProperty(std::string property);
+/**
+ * @brief check str to be int and assign
+ * @param[out] val assign variable
+ * @param[in] str input string
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_INVALID_PARAMETER invalid parameter.
+ */
+int setInt(int &val, std::string str);
+
/**
* @brief check str to be float and assign
* @param[out] val assign variable
unsigned int type = parseLayerProperty(key);
switch (static_cast<PropertyType>(type)) {
- case PropertyType::input_shape:
- status = dim.setTensorDim(value);
- break;
+ case PropertyType::unit: {
+ int width;
+ status = setInt(width, value);
+ NN_RETURN_STATUS();
+ dim.width(width);
+ } break;
case PropertyType::bias_zero: {
status = setBoolean(init_zero, value);
NN_RETURN_STATUS();
* epsilon = 5
* weight_decay = 6
* weight_decay_lambda = 7
+ * unit = 8
*
* InputLayer has 0, 1, 2, 3 properties.
- * FullyConnectedLayer has 0, 1, 4, 6, 7 properties.
+ * FullyConnectedLayer has 1, 4, 6, 7, 8 properties.
* BatchNormalizationLayer has 0, 1, 5, 6, 7 properties.
*/
- std::array<std::string, 9> property_string = {
- "input_shape", "bias_zero", "normalization",
- "standardization", "activation", "epsilon",
- "weight_decay", "weight_decay_lambda", "unknown"};
+ std::array<std::string, 10> property_string = {
+ "input_shape", "bias_zero", "normalization", "standardization",
+ "activation", "epsilon", "weight_decay", "weight_decay_lambda",
+ "unit", "unknown"};
for (i = 0; i < property_string.size(); i++) {
unsigned int size = (property_string[i].size() > property.size())
return ret;
}
+int setInt(int &val, std::string str) {
+ int status = ML_ERROR_NONE;
+ try {
+ val = std::stoi(str.c_str());
+ } catch (...) {
+ ml_loge("Error: Wrong Type. Must be int");
+ status = ML_ERROR_INVALID_PARAMETER;
+ }
+
+ return status;
+}
+
int setFloat(float &val, std::string str) {
int status = ML_ERROR_NONE;
try {
int status;
status = ml_nnlayer_create(&handle, ML_LAYER_TYPE_FC);
EXPECT_EQ(status, ML_ERROR_NONE);
- status = ml_nnlayer_set_property(handle, "input_shape=32:1:1:6270", NULL);
+ status = ml_nnlayer_set_property(handle, "unit=10", NULL);
EXPECT_EQ(status, ML_ERROR_NONE);
status = ml_nnlayer_set_property(handle, "bias_zero=true", NULL);