Beispiel #1
0
 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))); 
   }
 }
Beispiel #2
0
 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)); 
   }
 }
Beispiel #3
0
 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); 
 }
Beispiel #4
0
 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); 
 }
Beispiel #5
0
 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); 
 }
Beispiel #6
0
 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); 
 }
Beispiel #7
0
 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); 
 }
Beispiel #8
0
 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); 
 }
Beispiel #9
0
 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); 
 }