Example #1
0
void STLossLayer<Dtype>::Reshape(
  const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) {

	vector<int> tot_loss_shape(0);  // Loss layers output a scalar; 0 axes.
	top[0]->Reshape(tot_loss_shape);

	CHECK_EQ(bottom[0]->count(1), 6) << "Inputs theta must have dimension of 6.";

	N = bottom[0]->shape(0);

	vector<int> loss_shape(3);
	loss_shape[0] = N;
	loss_shape[1] = output_H_;
	loss_shape[2] = output_W_;
	loss_.Reshape(loss_shape);

	vector<int> dtheta_tmp_shape(2);
	dtheta_tmp_shape[0] = N * 6;
	dtheta_tmp_shape[1] = output_H_ * output_W_;
	dtheta_tmp_.Reshape(dtheta_tmp_shape);

	vector<int> all_ones_vec_shape(1);
	all_ones_vec_shape[0] = output_H_ * output_W_;
	all_ones_vec_.Reshape(all_ones_vec_shape);
}
Example #2
0
void LocLossLayer<Dtype>::Reshape(
  const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) {

	vector<int> tot_loss_shape(0);  // Loss layers output a scalar; 0 axes.
	top[0]->Reshape(tot_loss_shape);

	N = bottom[0]->count();

	vector<int> loss_shape(1);
	loss_shape[0] = N;
	loss_.Reshape(loss_shape);
}