• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ idx类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中idx的典型用法代码示例。如果您正苦于以下问题:C++ idx类的具体用法?C++ idx怎么用?C++ idx使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了idx类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: idx_copy

 void jitter::set(const idx<t_jitter> &j) {
   s = j.get(0);
   h = (int) j.get(1);
   w = (int) j.get(2);
   r = j.get(3);
   idx_copy(j, jitts);
 }
开发者ID:2php,项目名称:eblearn,代码行数:7,代码来源:dataset.cpp


示例2: draw_layer

  unsigned int draw_layer(idx<float> &img, int dimn, int layern, const char *s,
			  unsigned int h, unsigned int w) {
#ifdef __GUI__
    idx<float> layer = img.select(dimn, layern);
    draw_matrix(layer, s, h, w, 1.0, 1.0, (float)-1.0, (float)1.0);
#endif
    return img.dim(1) + 3;
  }
开发者ID:athuls,项目名称:gsra,代码行数:8,代码来源:dataset_generation.cpp


示例3: tmp

  void matlab::read_cast_matrix(mxArray *var, idx<T> &m) {
#ifdef __MATLAB__
    // allocate a temporary matrix with same type as original matrix type
    idx<Tmatlab> tmp(m.get_idxdim());
    // load data
    void *data = mxGetData(var);
    // copy to idx 
    memcpy(m.idx_ptr(), (Tmatlab*) data, m.nelements() * sizeof (Tmatlab));
    // copy-cast
    idx_copy(tmp, m);
#endif
  }
开发者ID:athuls,项目名称:gsra,代码行数:12,代码来源:matlab.hpp


示例4: idx_clear

 void padder<T>::pad(idx<T> &in, idx<T> &out) {
   // allocate padded buffer
   idxdim d = in;
   d.setdim(1, d.dim(1) + nrow + nrow2);
   d.setdim(2, d.dim(2) + ncol + ncol2);
   if (out.get_idxdim() != d)
     out.resize(d);
   idx_clear(out);
   // copy in to padded buffer
   idx<T> tmp = out.narrow(1, in.dim(1), nrow);
   tmp = tmp.narrow(2, in.dim(2), ncol);
   idx_copy(in, tmp);
   if (bmirror)
     mirror(in, out);
 }
开发者ID:2php,项目名称:eblearn,代码行数:15,代码来源:padder.hpp


示例5: out

 idx<T> padder<T>::pad(idx<T> &in) {
   // allocate padded buffer
   idxdim d = in;
   d.setdim(1, d.dim(1) + nrow + nrow2);
   d.setdim(2, d.dim(2) + ncol + ncol2);
   idx<T> out(d);
   idx_clear(out);
   // copy in to padded buffer
   idx<T> tmp = out.narrow(1, in.dim(1), nrow);
   tmp = tmp.narrow(2, in.dim(2), ncol);
   idx_copy(in, tmp);
   if (bmirror)
     mirror(in, out);
   // return result
   return out;
 }
开发者ID:2php,项目名称:eblearn,代码行数:16,代码来源:padder.hpp


示例6: draw_layer

unsigned int draw_layer(idx<float> &layer, const char *s,
			unsigned int h, unsigned int w) {
#ifdef __GUI__
  draw_matrix(layer, s, h, w, 1.0, 1.0, (float)-1.0, (float)1.0);
#endif
  return layer.dim(1) + 3;
}
开发者ID:2php,项目名称:eblearn,代码行数:7,代码来源:dsdisplay.cpp


示例7: display_images

  // display original and new images.
  void display_images(idx<ubyte> &classes, int label, idx<float> &original,
		      idx<float> &new_images, const int channels_mode,
		      idx<ubyte> &ds_names, int current_ds) {
#ifdef __GUI__
    unsigned int h = 0, w = 0;
    static unsigned int cnt = 0;
    idx<float> layer;

    // only display every 15 images
    if (cnt++ % 15 != 0) return ;
    
    // reset window and do a batch display
    disable_window_updates();
    clear_window();
    
    // original image (RGB)
    static string s;
    s = "RGB"; s += " - "; s += (char *) classes[label].idx_ptr();
    draw_matrix(original, s.c_str(), h, w);
    w = 0; h += new_images.dim(1) + 5;
    gui << at(h, w) << black_on_white();
    gui << ds_names[current_ds].idx_ptr() << " dataset:";
    h += 15;
    
    // new images
    idx_bloop1(image, new_images, float) {
      switch (channels_mode) {
      case 1: // YpUV
	w += draw_layer(image, 2, 0, "Yp", h, w);
	w += draw_layer(image, 2, 1, "U", h, w);
	w += draw_layer(image, 2, 2, "V", h, w);
	break ;
      case 3: // Yp
	w += draw_layer(image, 2, 0, "Yp", h, w);
	break ;
      case 4: { // YpH3
	w += draw_layer(image, 2, 0, "Yp", h, w);
	w += draw_layer(image, 2, 1, "H3", h, w);
	idx_addc(layer, (float)1.0, layer);
	idx_dotc(layer, (float)210.0, layer);
	w += layer.dim(1) + 5;
	static idx<float> rgb(layer.dim(0), layer.dim(1), 3);
	h3_to_rgb(layer, rgb);
	draw_matrix(rgb, "H3 (colored)", h, w);
	break ;
      }
      case 5: // VpH2SV
	w += draw_layer(image, 2, 0, "Vp", h, w);
	w += draw_layer(image, 2, 1, "H1", h, w);
	w += draw_layer(image, 2, 2, "H2", h, w);
	w += draw_layer(image, 2, 3, "S", h, w);
	w += draw_layer(image, 2, 4, "V", h, w);
	w = 0; h += image.dim(1) + 5;
	break ;
      }
    }
    enable_window_updates();
#endif
  }
开发者ID:athuls,项目名称:gsra,代码行数:60,代码来源:dataset_generation.cpp


示例8: image_region_to_rect

idx<T> image_region_to_rect(idx<T> &im, const rect<int> &r, uint oheight,
                            uint owidth, rect<int> *cropped,
                            uint dh, uint dw)
{
    // TODO: check that rectangle is within image
    if (im.order() != 2 && im.order() != 3)
        eblerror("expected a 2d or 3d input but got " << im);
    idxdim d(im);
    d.setdim(dh, oheight);
    d.setdim(dw, owidth);
    idx<T> res(d);

    float hcenter = r.h0 + (float)r.height / 2; // input height center
    float wcenter = r.w0 + (float)r.width / 2; // input width center
    // // limit centers to half the width/height away from borders
    // // to handle incorrect regions
    // hcenter = MIN((float)im.dim(dh) - (float)r.height/2,
    //            std::max((float)r.height/2, hcenter));
    // wcenter = MIN((float)im.dim(dw) - (float)r.width/2,
    //            std::max((float)r.width/2, wcenter));
    float h0 = hcenter - (float)oheight / 2; // out height offset in input
    float w0 = wcenter - (float)owidth / 2; // out width offset in input
    float h1 = hcenter + (float)oheight / 2;
    float w1 = wcenter + (float)owidth / 2;
    int gh0 = (int)std::max(0, (int)MIN(im.dim(dh), h0)); // input h offset
    int gw0 = (int)std::max(0, (int)MIN(im.dim(dw), w0)); // input w offset
    int gh1 = (int)std::max(0, (int)MIN(im.dim(dh), h1));
    int gw1 = (int)std::max(0, (int)MIN(im.dim(dw), w1));
    int h = gh1 - gh0 + std::max(0, -r.h0); // out height narrow
    int w = gw1 - gw0 + std::max(0, -r.w0); // out width narrow
    int fh0 = (int)std::max(0, (int)(gh0 - h0)); // out height offset narrow
    int fw0 = (int)std::max(0, (int)(gw0 - w0)); // out width offset narrow

    // narrow original image
    int hmin = std::max(0, std::min((int)res.dim(dh) - fh0,
                                    std::min((int)im.dim(dh) - gh0, h)));
    int wmin = std::max(0, std::min((int)res.dim(dw) - fw0,
                                    std::min((int)im.dim(dw) - gw0, w)));
    // clear result image
    idx_clear(res);
    if (hmin != 0 && wmin != 0)  // only copy if overlap with image
    {
        idx<T> tmpim = im.narrow(dh, hmin, gh0);
        tmpim = tmpim.narrow(dw, wmin, gw0);
        // narrow target image
        idx<T> tmpres = res.narrow(dh, hmin, fh0);
        tmpres = tmpres.narrow(dw, wmin, fw0);
        // copy original to target
        idx_copy(tmpim, tmpres);
    }
    // set cropped rectangle to region in the output image containing input
    if (cropped)
    {
        cropped->h0 = fh0;
        cropped->w0 = fw0;
        cropped->height = hmin;
        cropped->width = wmin;
    }
    return res;
}
开发者ID:1292765944,项目名称:MobileDemo,代码行数:60,代码来源:padder.hpp


示例9: serialize

    void serialize(Archive & ar, idx<ubyte>& mat, const unsigned int version) {
      intg d1, d2, d3;
      if (Archive::is_saving::value) { // saving to stream
	if (!mat.contiguousp())
	  eblerror("expected contiguous idx for serialization");
	if (mat.order() != 3)
	  eblerror("no support for idx order != 3 for now, got: " << mat);

	d1 = mat.dim(0); 
	d2 = mat.dim(1); 
	d3 = mat.dim(2); 
	
	ar & d1;
	ar & d2;
	ar & d3;
	idx_aloop1(m, mat, ubyte) {
	  ar & *m;
	}
      } else { // loading from stream
开发者ID:athuls,项目名称:gsra,代码行数:19,代码来源:mpidetect.cpp


示例10: eblerror

idxlooper<T>::idxlooper(idx<T> &m, int ld) : idx<T>((dummyt*)0) {
  if (m.order() == 0) // TODO: allow looping once on 0-order idx
    eblerror("cannot loop on idx with order 0. idx is: " << m);
  i = 0;
  dimd = m.spec.dim[ld];
  modd = m.spec.mod[ld];
  m.spec.select_into(&(this->spec), ld, i);
  this->storage = m.storage;
  this->storage->lock();
}
开发者ID:2php,项目名称:eblearn,代码行数:10,代码来源:idxiter.hpp


示例11: if

bool detection_thread<T>::set_data(idx<ubyte> &frame2,
                                   std::string &fullname,
                                   std::string &name, uint id) {
  // lock data (non blocking)
  if (!mutex_in.trylock())
    return false;
  // check frame is correctly allocated, if not, allocate.
  if (frame2.order() != uframe.order())
    uframe = idx<ubyte>(frame2.get_idxdim());
  else if (frame2.get_idxdim() != uframe.get_idxdim())
    uframe.resize(frame2.get_idxdim());
  idx_copy(frame2, uframe);	// copy frame
  frame_loaded = true;        // frame is loaded
  frame_fullname = fullname;
  frame_name = name;		// copy name
  frame_id   = id;		// copy frame_id
  in_updated = true;		// reset updated flag
  bavailable = false;		// declare thread as not available
  bfed       = true;		// data has been fed at least once
  mutex_in.unlock();		// unlock data
  return true;		// confirm that we copied data.
}
开发者ID:2php,项目名称:eblearn,代码行数:22,代码来源:detection_thread.hpp


示例12: image_paste_center

 void image_paste_center(idx<T> &in, idx<T> &out) {
   if (in.order() != 3 || out.order() != 3)
     eblerror("expected 3d idx but got " << in << " and " << out);
   int d0 = 1;
   int d1 = d0 + 1;
   intg ci = in.dim(d0) - out.dim(d0);
   intg cj = in.dim(d1) - out.dim(d1);
   intg xci = (int) (ci / 2);
   intg xcj = (int) (cj / 2);
   idx<T> i = in.narrow(d0, out.dim(d0), xci);
   i = i.narrow(d1, out.dim(d1), xcj);
   idx_copy(i, out);
 }
开发者ID:2php,项目名称:eblearn,代码行数:13,代码来源:padder.hpp


示例13: make_pairs

  //! Return an idx of dimensions Nx2 containing all possible N similar pairs.
  idx<int> make_pairs(idx<int> &labels) {
    // allocate maximum number of pairs
    idx<int> pairs((labels.dim(0) * (labels.dim(0) - 1)) / 2, 2);
    int n = 0, r = 0;
    // for each label, loop over all following labels to find pairs
    for (int i = 0; i < labels.dim(0) - 1; ++i) {
      for (int j = i + 1; j < labels.dim(0); ++j) {
	if (labels.get(i) == labels.get(j)) {
	  r = drand(0.0, 1.0); // randomize distribution as 1st or 2nd element
	  pairs.set(i, n, (r > 0.5) ? 0 : 1);
	  pairs.set(j, n, (r > 0.5) ? 1 : 0);
	  n++;
	}
      }
    }
    pairs.resize(n, pairs.dim(1));
    return pairs;
  }
开发者ID:athuls,项目名称:gsra,代码行数:19,代码来源:dataset_generation.cpp


示例14: pthread_mutex_lock

  bool tracking_thread<Tnet>::get_data(vector<bbox*> &bboxes2,
				       idx<ubyte> &frame2, idx<ubyte> &tpl2) {
    // lock data
    pthread_mutex_lock(&mutex_out);
    // only read data if it has been updated
    if (!out_updated) {
      // unlock data
      pthread_mutex_unlock(&mutex_out);
      return false;
    }
    // clear bboxes
    for (ibox = bboxes2.begin(); ibox != bboxes2.end(); ++ibox) {
      if (*ibox)
	delete *ibox;
    }
    bboxes2.clear();
    // copy bboxes pointers (now responsible for deleting them).
    for (ibox = bboxes.begin(); ibox != bboxes.end(); ++ibox) {
      bboxes2.push_back(*ibox);
    }
    // check frame is correctly allocated, if not, allocate.
    if (frame2.order() != frame.order()) 
      frame2 = idx<ubyte>(frame.get_idxdim());
    else if (frame2.get_idxdim() != frame.get_idxdim())
      frame2.resize(frame.get_idxdim());
    // copy frame
    idx_copy(frame, frame2);    
    // check tpl is correctly allocated, if not, allocate.
    if (tpl2.order() != tpl.order()) 
      tpl2 = idx<ubyte>(tpl.get_idxdim());
    else if (tpl2.get_idxdim() != tpl.get_idxdim())
      tpl2.resize(tpl.get_idxdim());
    // copy tpl
    idx_copy(tpl, tpl2);    
    // reset updated flag
    out_updated = false; 
    // unlock data
    pthread_mutex_unlock(&mutex_out);
    // confirm that we copied data.
    return true;
  }
开发者ID:athuls,项目名称:gsra,代码行数:41,代码来源:tracking_thread.hpp


示例15: read_cast_matrix

 void read_cast_matrix(FILE *fp, idx<T2> &out) {
   idx<T> m(out.get_idxdim());
   read_matrix_body(fp, m);
   idx_copy(m, out);
 }
开发者ID:athuls,项目名称:gsra,代码行数:5,代码来源:idxIO.hpp


示例16: idx_copy

void padder<T>::mirror(idx<T> &in, idx<T> &padded)
{
    idx<T> tmp, tmp2;
    int i;
    // mirror border left
    for (i = std::max(0, (int)(ncol - in.dim(1) / 2)); i < ncol; ++i)
    {
        tmp2 = in.narrow(1, 1, ncol - i - 1);
        tmp = padded.narrow(1, 1, i);
        tmp = tmp.narrow(2, in.dim(2), ncol);
        idx_copy(tmp2, tmp);
    }

    // mirror border right
    for (i = std::max(0, (int)(ncol - in.dim(1) / 2)); i < ncol; ++i)
    {
        tmp2 = in.narrow(1, 1, in.dim(1) - ncol - 1 + i);
        tmp = padded.narrow(1, 1, padded.dim(1) - 1 - i);
        tmp = tmp.narrow(2, in.dim(2), ncol);
        idx_copy(tmp2, tmp);
    }

    // mirror border top using out as input
    for (i = std::max(0, (int)(nrow - in.dim(2) / 2)); i < nrow; ++i)
    {
        tmp2 = padded.narrow(2, 1, nrow + nrow - i - 1);
        tmp = padded.narrow(2, 1, i);
        idx_copy(tmp2, tmp);
    }

    // mirror border bottom using out as input
    for (i = std::max(0, (int)(nrow - in.dim(2) / 2)); i < nrow; ++i)
    {
        tmp2 = padded.narrow(2, 1, padded.dim(2) - nrow * 2 - 1 + i);
        tmp = padded.narrow(2, 1, padded.dim(2) - 1 - i);
        idx_copy(tmp2, tmp);
    }
}
开发者ID:1292765944,项目名称:MobileDemo,代码行数:38,代码来源:padder.hpp


示例17: targets

 cost_module<T1,T2,Tstate1,Tstate2>::cost_module(idx<T1> &targets_)
   : targets(targets_), in2(targets.select(0, 0)), energies(targets_.dim(0)) {
 }
开发者ID:athuls,项目名称:gsra,代码行数:3,代码来源:ebl_cost.hpp


示例18: convert_image

  // convert the input image <src> into the <channels_mode> format.
  void convert_image(idx<float> &src, idx<float> &dst, const int channels_mode,
		     unsigned int fkernel_size) {
    idxdim d = idxdim(src), d2 = idxdim(src);
    d2.setdim(2, dst.dim(2));
    idx<float> in, out, src2(d), tmp(d2), tmp2;
    if (fkernel_size > 0) {
      src2 = src.narrow(0, src.dim(0) - fkernel_size + 1,
			floor(fkernel_size / 2));
      src2 = src2.narrow(1, src.dim(1) - fkernel_size + 1,
			 floor(fkernel_size / 2));
      tmp2 = tmp.narrow(0, tmp.dim(0) - fkernel_size + 1,
			floor(fkernel_size / 2));
      tmp2 = tmp2.narrow(1, tmp.dim(1) - fkernel_size + 1,
			 floor(fkernel_size / 2));
    }
    idx_clear(dst);
    // narrow dst to fit src if smaller
    if (src2.dim(0) < dst.dim(0))
      dst = dst.narrow(0, src2.dim(0), floor((dst.dim(0) - src2.dim(0)) / 2));
    if (src2.dim(1) < dst.dim(1))
      dst = dst.narrow(1, src2.dim(1), floor((dst.dim(1) - src2.dim(1)) / 2));
    // converting
    switch (channels_mode) {
    case 0: // RGB
      idx_copy(src2, dst);
      image_global_normalization(dst);
      break ;
    case 1: // YUV
      rgb_to_yuv(src, tmp);
      in = tmp.select(2, 0);
      d = idxdim(in);
      out = idx<float>(d);      
      image_mexican_filter(in, out, 6, fkernel_size);
      idx_copy(out, in);
      idx_copy(tmp2, dst);
      image_global_normalization(dst);      
      break ;
    case 3: { // Y only 
      rgb_to_y(src, tmp);
      in = tmp.select(2, 0);
      d = idxdim(in);
      out = idx<float>(d);      
      image_global_normalization(in);
      image_local_normalization(in, out, fkernel_size);      
      idx_copy(out, in);
      idx_copy(tmp2, dst);
    }
      break ;
    case 4: // YH3
      rgb_to_yh3(src, tmp);
      in = tmp.select(2, 0);
      d = idxdim(in);
      out = idx<float>(d);      
      image_mexican_filter(in, out, 6, fkernel_size);
      image_global_normalization(out);
      idx_copy(out, in);
      idx_copy(tmp2, dst);
      break ;
    case 5: // VpH2SV
      rgb_to_vph2sv(src, tmp, 6, fkernel_size);
      idx_copy(tmp2, dst);
      break ;
    default:
      cerr << "unknown channel mode: " << channels_mode << endl;
      eblerror("unknown channel mode");
    }
  }
开发者ID:athuls,项目名称:gsra,代码行数:68,代码来源:dataset_generation.cpp


示例19: display

int display(list<string>::iterator &ifname,
	    bool signd, bool load, list<string> *mats) {
  //cout << "displaying " << ifname->c_str() << endl;
  // conf mode
  if (conf)
    return display_net<T>(ifname, signd, load, mats);
  // mat mode
  if (is_matrix(ifname->c_str())) {
    idxdim d = get_matrix_dims(ifname->c_str());
    if (interleaved)
      d.shift_dim(0, 2);
    if (save_individually || print
        || !(d.order() == 2  || (d.order() == 3 &&
                                 (d.dim(2) == 1 || d.dim(2) == 3)))) {
      // this is probably not an image, just display info and print matrix
      string type;
      get_matrix_type(ifname->c_str(), type);
      idx<T> m = load_matrix<T>(ifname->c_str());
      cout << "Matrix " << ifname->c_str() << " is of type " << type
	   << " with dimensions " << d << " (min " << idx_min(m)
	   << ", max " << idx_max(m) << ", mean " << idx_mean(m)
	   << "):" << endl;
      m.print();
      if (has_multiple_matrices(ifname->c_str())) {
	midx<T> ms = load_matrices<T>(ifname->c_str(), true);
	// saving sub-matrices
	if (save_individually) {
	  cout << "Saving each sub-matrix of " << *ifname << " individually..."
	       << endl;
	  save_matrices_individually(ms, *ifname, true);
	}
	// printing sub-matrices
	cout << "This file contains " << m << " matrices: ";
	if (ms.order() == 1) {
	  for (intg i = 0; i < ms.dim(0); ++i) {
	    idx<T> tmp = ms.mget(i);
	    cout << tmp.info() << " ";
	  }
	} else if (ms.order() == 2) {
	  for (intg i = 0; i < ms.dim(0); ++i) {
	    for (intg j = 0; j < ms.dim(1); ++j) {
	      idx<T> tmp = ms.mget(i, j);
	      cout << tmp.info() << " ";
	    }
	    cout << endl;
	  }
	}
	cout << endl;
      } else
	cout << "This is a single-matrix file." << endl;
      return 0;
    }
  }
  // image mode
  int loaded = 0;
  static idx<T> mat;
  uint h = 0, w = 0, rowh = 0, maxh = 0;
  list<string>::iterator fname = ifname;
#ifdef __GUI__
  disable_window_updates();
  clear_window();
  if (show_filename) {
    gui << at(h, w) << black_on_white() << ifname->c_str();
    h += 16;
  }
#endif
  maxh = h;
  for (uint i = 0; i < nh; ++i) {
    rowh = maxh;
    for (uint j = 0; j < nw; ++j) {
      if (fname == mats->end())
	fname = mats->begin();
      try {
	//      if (load)
	mat = load_image<T>(*fname);
	if (print)
	  cout << *fname << ": " << mat << endl << mat.str() << endl;
	// show only some channels
	if (chans >= 0)
	  mat = mat.select(2, chans);
	loaded++;
	maxh = (std::max)(maxh, (uint) (rowh + mat.dim(0)));
	T min = 0, max = 0;
#ifdef __GUI__
	if (autorange || signd) {
	  if (autorange) {
	    min = idx_min(mat);
	    max = idx_max(mat);
	  } else if (signd) {
	    T matmin = idx_min(mat);
	    if ((double)matmin < 0) {
	      min = -1;
	      max = -1;
	    }
	  }
	  draw_matrix(mat, rowh, w, zoom, zoom, min, max);
	} else
	  draw_matrix(mat, rowh, w, zoom, zoom, (T) range[0], (T) range[1]);
#endif
	w += mat.dim(1) + 1;
//.........这里部分代码省略.........
开发者ID:2php,项目名称:eblearn,代码行数:101,代码来源:matshow.cpp


示例20: generic_conv_net

  generic_conv_net(parameter &trainableParam, 
		   intg output_size) 
    : layers_n<state_idx>(true) { // owns modules  
    cout << "Initializing ConvNet..." << endl;
    
    //! Define the number of feature maps per layer (C0, C1, C2)
    intg featureMaps0 = 6;
    intg featureMaps1 = 12;
    intg featureMaps2 = 40;

    //! Define tables of connections between layers.
    //! These two are fully connected layer, i.e. each feature map in a layer
    //! is connected to every feature map in the previous layer
    table0 = full_table(1, featureMaps0); //! from input to C0
    table2 = full_table(featureMaps1, featureMaps2); //! from S1 to C2

    //! ... whereas the connections there are sparse (S0 to C1):
    table1 = idx<intg>(44, 2); //! from S0 to C1
    intg tbl[44][2] =
      {{0, 0},  {1, 0},  {2, 0}, //! 0,1,2 in S0 connected to 0 in C1
       {1, 1},  {2, 1},  {3, 1}, //! and so on...
       {2, 2},  {3, 2},  {4, 2},
       {3, 3},  {4, 3},  {5, 3},
       {4, 4},  {5, 4},  {0, 4},
       {5, 5},  {0, 5},  {1, 5},

       {0, 6},  {1, 6},  {2, 6},  {3, 6},
       {1, 7},  {2, 7},  {3, 7},  {4, 7},
       {2, 8},  {3, 8},  {4, 8},  {5, 8},
       {3, 9},  {4, 9},  {5, 9},  {0, 9},
       {4, 10}, {5, 10}, {0, 10}, {1, 10},

       {0, 11}, {1, 11}, {2, 11}, {3, 11}, {4, 11}, {5, 11}};
    memcpy(table1.idx_ptr(), tbl, table1.nelements() * sizeof (intg));


    //! Finally we initialize the architecture of the ConvNet.
    //! In this case we create a CSCSCF network.
    //! It's easy to change the architecture, by simply removing/adding a call
    //! to addModule(...)

    //! C0 Layer
    add_module(new nn_layer_convolution(trainableParam, //! Shared weights
					7, 7, //! Dim of kernel 
					1, 1, //! size of subsampling
					table0), //! Conx btwn input layer and C0 
	       //! state_idx holds the feature maps of C0
	       new state_idx(featureMaps0,1,1));
    //! S0 Layer
    add_module(new nn_layer_subsampling(trainableParam, 
					2, 2,  //! Dim of stride
					2, 2,  //! Dim of subsampling mask
					featureMaps0),
	       new state_idx(featureMaps0,1,1));
    //! C1 Layer
    add_module(new nn_layer_convolution(trainableParam, 
					7, 7,
					1, 1, 
					table1), 
	       new state_idx(featureMaps1,1,1));
    //! S1 Layer
    add_module(new nn_layer_subsampling(trainableParam, 
					2, 2, 
					2, 2, 
					featureMaps1),
	       new state_idx(featureMaps1,1,1));
    //! C2 Layer
    add_module(new nn_layer_convolution(trainableParam, 
					7, 7,
					1, 1, 
					table2), 
	       new state_idx(featureMaps2,1,1));
    //! F Layer
    add_last_module(new nn_layer_full(trainableParam, 
				      featureMaps2, 
				      output_size));

  }
开发者ID:athuls,项目名称:gsra,代码行数:78,代码来源:main.cpp



注:本文中的idx类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ifstream类代码示例发布时间:2022-05-31
下一篇:
C++ id_type类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap