Esempio n. 1
0
// Usage: caffe_('net_backward', hNet)
//20160215find
static void net_backward(MEX_ARGS) {
  mxCHECK(nrhs <= 3 && mxIsStruct(prhs[0]),
    "Usage: caffe_('net_backward', hNet, from_layer=end, to_layer=0)");
  Net<float>* net = handle_to_ptr<Net<float> >(prhs[0]);
  if (nrhs == 1)
    net->Backward();
  else if (nrhs == 2) {
    mxCHECK(mxIsDouble(prhs[1]),
      "Usage: caffe_('net_backward', hNet, from_layer=end, to_layer=0)");
    net->BackwardFrom((int)mxGetScalar(prhs[1]));
  }
  else if (nrhs == 3) {
    mxCHECK(mxIsDouble(prhs[1]) && mxIsDouble(prhs[2]),
      "Usage: caffe_('net_backward', hNet, from_layer=end, to_layer=0)");
    net->BackwardFromTo((int)mxGetScalar(prhs[1]), (int)mxGetScalar(prhs[2]));
  }
}
Esempio n. 2
0
EXPORT void caffe_net_BackwardFromTo(void *netAnon, int start, int end)
{
	Net<float> *net = (Net<float> *)netAnon;
	net->BackwardFromTo(start, end);
}