Beispiel #1
0
// Usage: caffe_('net_forward', hNet)
static void net_forward(MEX_ARGS) {
	mxCHECK(nrhs <= 3 && mxIsStruct(prhs[0]),
		"Usage: caffe_('net_forward', hNet, from_layer=0, to_layer=end)");
	Net<float>* net = handle_to_ptr<Net<float> >(prhs[0]);
	if (nrhs == 1)
		net->ForwardPrefilled();
	else if (nrhs == 2)
	{
		mxCHECK(mxIsDouble(prhs[1]),
			"Usage: caffe_('net_forward', hNet, from_layer=0, to_layer=end)");
		net->ForwardFrom((int)mxGetScalar(prhs[1]));
	}
	else if (nrhs == 3)
	{
		mxCHECK(mxIsDouble(prhs[1]) && mxIsDouble(prhs[2]),
			"Usage: caffe_('net_forward', hNet, from_layer=0, to_layer=end)");
		net->ForwardFromTo((int)mxGetScalar(prhs[1]), (int)mxGetScalar(prhs[2]));
	}
}
Beispiel #2
0
EXPORT float caffe_net_ForwardFromTo(void *netAnon, int start, int end)
{
	Net<float> *net = (Net<float> *)netAnon;
	return net->ForwardFromTo(start, end);
}