* 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. */
| 344 | * the {ExactNum,Min,Max}{Bottom,Top}Blobs() functions. |
| 345 | */ |
| 346 | virtual void CheckBlobCounts(const vector<Blob<Dtype>*>& bottom, |
| 347 | const vector<Blob<Dtype>*>& top) { |
| 348 | if (ExactNumBottomBlobs() >= 0) { |
| 349 | CHECK_EQ(ExactNumBottomBlobs(), bottom.size()) |
| 350 | << type() << " Layer takes " << ExactNumBottomBlobs() |
| 351 | << " bottom blob(s) as input."; |
| 352 | } |
| 353 | if (MinBottomBlobs() >= 0) { |
| 354 | CHECK_LE(MinBottomBlobs(), bottom.size()) |
| 355 | << type() << " Layer takes at least " << MinBottomBlobs() |
| 356 | << " bottom blob(s) as input."; |
| 357 | } |
| 358 | if (MaxBottomBlobs() >= 0) { |
| 359 | CHECK_GE(MaxBottomBlobs(), bottom.size()) |
| 360 | << type() << " Layer takes at most " << MaxBottomBlobs() |
| 361 | << " bottom blob(s) as input."; |
| 362 | } |
| 363 | if (ExactNumTopBlobs() >= 0) { |
| 364 | CHECK_EQ(ExactNumTopBlobs(), top.size()) |
| 365 | << type() << " Layer produces " << ExactNumTopBlobs() |
| 366 | << " top blob(s) as output."; |
| 367 | } |
| 368 | if (MinTopBlobs() >= 0) { |
| 369 | CHECK_LE(MinTopBlobs(), top.size()) |
| 370 | << type() << " Layer produces at least " << MinTopBlobs() |
| 371 | << " top blob(s) as output."; |
| 372 | } |
| 373 | if (MaxTopBlobs() >= 0) { |
| 374 | CHECK_GE(MaxTopBlobs(), top.size()) |
| 375 | << type() << " Layer produces at most " << MaxTopBlobs() |
| 376 | << " top blob(s) as output."; |
| 377 | } |
| 378 | if (EqualNumBottomTopBlobs()) { |
| 379 | CHECK_EQ(bottom.size(), top.size()) |
| 380 | << type() << " Layer produces one top blob as output for each " |
| 381 | << "bottom blob input."; |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | /** |
| 386 | * Called by SetUp to initialize the weights associated with any top blobs in |