static void getInts(const char *str, AzByte dlm, AzIntArr *ia) { ia->reset(); AzStrPool sp; getStrings(str, dlm, &sp); int ix; for (ix = 0; ix < sp.size(); ++ix) { ia->put(atol(sp.c_str(ix))); } }
static void getFloats(const char *str, AzByte dlm, AzDvect *v) { AzIFarr ifa; AzStrPool sp; getStrings(str, dlm, &sp); int ix; for (ix = 0; ix < sp.size(); ++ix) { ifa.put(-1, atof(sp.c_str(ix))); } v->reform(ifa.size()); for (ix = 0; ix < ifa.size(); ++ix) { v->set(ix, ifa.get(ix)); } }
inline void vInt(const char *kw, int *out_value) { if (param == NULL) return; const char *ptr = pointAfterKw(param, kw); if (ptr == NULL) return; *out_value = atol(ptr); if (doCheck) sp_used_kw.put(kw); }
inline void vStr(const char *kw, AzBytArr *s) { if (param == NULL) return; const char *bp = pointAfterKw(param, kw); if (bp == NULL) return; const char *ep = pointAt(bp, dlm); s->reset(); s->concat(bp, Az64::ptr_diff(ep-bp, "AzParam::vStr")); if (doCheck) sp_used_kw.put(kw); }
inline void vLoss(const char *kw, AzLossType *out_loss) { if (param == NULL) return; AzBytArr s; vStr(kw, &s); if (s.length() > 0) { *out_loss = AzLoss::lossType(s.c_str()); } if (doCheck) sp_used_kw.put(kw); }
virtual void read(AzFile *file) { AzpCNet3::read(file); int my_version = AzTools::read_header(file, reserved_len); iia_layer_conn.read(file); ia_layer_order.read(file); layer_info.read(file); conn.read(file); sp_conn.read(file); }
virtual void write(AzFile *file) { AzpCNet3::write(file); AzTools::write_header(file, version, reserved_len); iia_layer_conn.write(file); ia_layer_order.writec(file); /* write2: const */ layer_info.write(file); conn.write(file); sp_conn.writec(file); }
inline void swOff(bool *swch, const char *kw, bool doCheckKw=true) { if (param == NULL) return; if (doCheckKw) { if (strstr(kw, "Dont") != kw && (strstr(kw, "No") != kw && strstr(kw, "Normalize") == NULL)) { throw new AzException("AzParam::swOff", "Off-kw should start with \"dont\" or \"No\"", kw); } } const char *ptr = pointAfterKw(param, kw); if (ptr != NULL && (*ptr == '\0' || *ptr == dlm) ) { *swch = false; } if (doCheck) sp_used_kw.put(kw); }
AzpData_img() : data_num(0), channels(-1), sz1(0), sz2(0), dummy_ydim(-1), current_batch(0), total_data_num(-1), data_scale(-1), min_tar(1e+10), max_tar(-1e+10) { sp_x_ext.put(AzpData_Ext_xpmat, AzpData_Ext_x); sp_y_ext.put(AzpData_Ext_ysmat, AzpData_Ext_y); }