ML_TRAIN_VERIFY_VALID_HANDLE(obj_h); \
std::lock_guard<std::mutex> ml_train_lock(GLOCK); \
ML_TRAIN_GET_VALID_HANDLE(obj, obj_h, obj_type, obj_name); \
+ obj->m.lock(); \
if (!obj->in_use) \
obj->magic = 0; \
- obj->m.lock(); \
} while (0)
/**
ML_TRAIN_VERIFY_VALID_HANDLE(model); \
std::lock_guard<std::mutex> ml_train_lock(GLOCK); \
ML_TRAIN_GET_VALID_HANDLE(nnmodel, model, ml_train_model, "model"); \
- nnmodel->magic = 0; \
nnmodel->m.lock(); \
+ nnmodel->magic = 0; \
} while (0)
/**
*
*/
Exporter::Exporter(flatbuffers::FlatBufferBuilder *fbb) :
- fbb(fbb),
- stored_result(nullptr),
- is_exported(false) {}
+ fbb(fbb), stored_result(nullptr), is_exported(false) {}
#endif
/**
auto strides = std::get<std::array<props::Stride, CONV2D_DIM>>(props);
assert(strides.size() == CONV2D_DIM);
- auto padding = std::get<props::Padding2D>(props).get();
- assert(padding == "same" || padding == "valid");
+ const auto &padding = std::get<props::Padding2D>(props).get();
+ if (padding != "same" && padding != "valid") {
+ std::ostringstream ss;
+ ss << "Unsupported padding type; \"" << padding
+ << "\" is not supported. Use \"same\" or \"valid\".";
+ throw std::runtime_error(ss.str());
+ }
auto options = tflite::CreateConv2DOptions(*fbb, tflite_padding(padding),
strides.at(0), strides.at(1))
.Union();