virtual inline int MinTopBlobs() const { return -1; }
virtual inline int MaxTopBlobs() const { return -1; }
+ // EqualNumBottomTopBlobs should return true for layers requiring an equal
+ // number of bottom and top blobs.
+ virtual inline bool EqualNumBottomTopBlobs() const { return false; }
+
// Declare for each bottom blob whether to allow force_backward -- that is,
// if AllowForceBackward(i) == false, we will ignore the force_backward
// setting and backpropagate to blob i only if it needs gradient information
<< type_name() << " Layer produces at most " << MaxTopBlobs()
<< " top blob(s) as output.";
}
+ if (EqualNumBottomTopBlobs()) {
+ CHECK_EQ(bottom.size(), top.size())
+ << type_name() << " Layer produces one top blob as output for each "
+ << "bottom blob input.";
+ }
}
DISABLE_COPY_AND_ASSIGN(Layer);
virtual inline LayerParameter_LayerType type() const {
return LayerParameter_LayerType_CONVOLUTION;
}
- virtual inline int ExactNumBottomBlobs() const { return 1; }
- virtual inline int ExactNumTopBlobs() const { return 1; }
+ virtual inline int MinBottomBlobs() const { return 1; }
+ virtual inline int MinTopBlobs() const { return 1; }
+ virtual inline bool EqualNumBottomTopBlobs() const { return true; }
protected:
virtual Dtype Forward_cpu(const vector<Blob<Dtype>*>& bottom,