* Called by the parent Layer's SetUp to check that the number of bottom * and top Blobs provided as input match the expected numbers specified by * the {ExactNum,Min,Max}{Bottom,Top}Blobs() functions. */
| 369 | * the {ExactNum,Min,Max}{Bottom,Top}Blobs() functions. |
| 370 | */ |
| 371 | virtual void CheckBlobCounts(const vector<Blob<Dtype>*>& bottom, |
| 372 | const vector<Blob<Dtype>*>& top) { |
| 373 | if (ExactNumBottomBlobs() >= 0) { |
| 374 | CHECK_EQ(ExactNumBottomBlobs(), bottom.size()) |
| 375 | << type() << " Layer takes " << ExactNumBottomBlobs() |
| 376 | << " bottom blob(s) as input."; |
| 377 | } |
| 378 | if (MinBottomBlobs() >= 0) { |
| 379 | CHECK_LE(MinBottomBlobs(), bottom.size()) |
| 380 | << type() << " Layer takes at least " << MinBottomBlobs() |
| 381 | << " bottom blob(s) as input."; |
| 382 | } |
| 383 | if (MaxBottomBlobs() >= 0) { |
| 384 | CHECK_GE(MaxBottomBlobs(), bottom.size()) |
| 385 | << type() << " Layer takes at most " << MaxBottomBlobs() |
| 386 | << " bottom blob(s) as input."; |
| 387 | } |
| 388 | if (ExactNumTopBlobs() >= 0) { |
| 389 | CHECK_EQ(ExactNumTopBlobs(), top.size()) |
| 390 | << type() << " Layer produces " << ExactNumTopBlobs() |
| 391 | << " top blob(s) as output."; |
| 392 | } |
| 393 | if (MinTopBlobs() >= 0) { |
| 394 | CHECK_LE(MinTopBlobs(), top.size()) |
| 395 | << type() << " Layer produces at least " << MinTopBlobs() |
| 396 | << " top blob(s) as output."; |
| 397 | } |
| 398 | if (MaxTopBlobs() >= 0) { |
| 399 | CHECK_GE(MaxTopBlobs(), top.size()) |
| 400 | << type() << " Layer produces at most " << MaxTopBlobs() |
| 401 | << " top blob(s) as output."; |
| 402 | } |
| 403 | if (EqualNumBottomTopBlobs()) { |
| 404 | CHECK_EQ(bottom.size(), top.size()) |
| 405 | << type() << " Layer produces one top blob as output for each " |
| 406 | << "bottom blob input."; |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | /** |
| 411 | * Called by SetUp to initialize the weights associated with any top blobs in |