| 413 | } |
| 414 | |
| 415 | int testSamePaddingConvolution2() { |
| 416 | |
| 417 | Specification::Model m1; |
| 418 | |
| 419 | auto *topIn = m1.mutable_description()->add_input(); |
| 420 | topIn->set_name("input"); |
| 421 | auto *shape = topIn->mutable_type()->mutable_multiarraytype(); |
| 422 | auto *shape1 = shape->mutable_shaperange()->add_sizeranges(); |
| 423 | shape1->set_lowerbound(4); |
| 424 | shape1->set_upperbound(4); |
| 425 | auto *shape2 = shape->mutable_shaperange()->add_sizeranges(); |
| 426 | shape2->set_lowerbound(100); |
| 427 | shape2->set_upperbound(100); |
| 428 | auto *shape3 = shape->mutable_shaperange()->add_sizeranges(); |
| 429 | shape3->set_lowerbound(100); |
| 430 | shape3->set_upperbound(200); |
| 431 | |
| 432 | auto *out = m1.mutable_description()->add_output(); |
| 433 | out->set_name("output"); |
| 434 | out->mutable_type()->mutable_multiarraytype(); |
| 435 | |
| 436 | auto *nn = m1.mutable_neuralnetwork(); |
| 437 | |
| 438 | Specification::NeuralNetworkLayer *convLayer = nn->add_layers(); |
| 439 | convLayer->add_input("input"); |
| 440 | convLayer->add_output("output"); |
| 441 | Specification::ConvolutionLayerParams *convParams = convLayer->mutable_convolution(); |
| 442 | convParams->set_outputchannels(5); |
| 443 | convParams->set_kernelchannels(4); |
| 444 | convParams->add_kernelsize(7); |
| 445 | convParams->add_kernelsize(8); |
| 446 | convParams->mutable_same(); |
| 447 | convParams->add_stride(2); |
| 448 | convParams->add_stride(3); |
| 449 | convParams->set_hasbias(false); |
| 450 | for (int i = 0; i < 5*4*7*8; i++) { |
| 451 | convParams->mutable_weights()->add_floatvalue(1.0); |
| 452 | } |
| 453 | |
| 454 | NeuralNetworkShaper shapes(m1); |
| 455 | |
| 456 | const ShapeConstraint &inShape = shapes.shape("input"); |
| 457 | ML_ASSERT(inShape.sequenceRange().minimumValue() == 0); |
| 458 | ML_ASSERT(inShape.sequenceRange().maximumValue().isUnbound()); |
| 459 | |
| 460 | ML_ASSERT(inShape.batchRange().minimumValue() == 0); |
| 461 | ML_ASSERT(inShape.batchRange().maximumValue().isUnbound()); |
| 462 | |
| 463 | ML_ASSERT(inShape.channelRange().minimumValue() == 4); |
| 464 | ML_ASSERT(inShape.channelRange().maximumValue().value() == 4); |
| 465 | |
| 466 | ML_ASSERT(inShape.heightRange().minimumValue() == 100); |
| 467 | ML_ASSERT(inShape.heightRange().maximumValue().value() == 100); |
| 468 | |
| 469 | ML_ASSERT(inShape.widthRange().minimumValue() == 100); |
| 470 | ML_ASSERT(inShape.widthRange().maximumValue().value() == 200); |
| 471 | |
| 472 | const ShapeConstraint &outShape = shapes.shape("output"); |
nothing calls this directly
no test coverage detected