| 421 | } |
| 422 | |
| 423 | void CreateConvolution2dGraph(Graph &graph, const unsigned int* inputShape, |
| 424 | const unsigned int* weightsShape, const unsigned int* outputShape, |
| 425 | DataLayout dataLayout = DataLayout::NCHW) |
| 426 | { |
| 427 | armnn::TensorInfo inputInfo(4, inputShape, DataType::Float32); |
| 428 | armnn::TensorInfo outputInfo(4, outputShape, DataType::Float32); |
| 429 | |
| 430 | std::vector<float> weightsVector(90); |
| 431 | armnn::ConstTensor weights( |
| 432 | armnn::TensorInfo(4, weightsShape, armnn::DataType::Float32, 0.0f, 0, true), |
| 433 | weightsVector); |
| 434 | |
| 435 | Convolution2dDescriptor desc; |
| 436 | desc.m_BiasEnabled = false; |
| 437 | desc.m_StrideX = 1; |
| 438 | desc.m_StrideY = 1; |
| 439 | desc.m_DataLayout = dataLayout; |
| 440 | |
| 441 | Layer* input = graph.AddLayer<InputLayer>(0, "input"); |
| 442 | input->GetOutputSlot().SetTensorInfo(inputInfo); |
| 443 | |
| 444 | ConstantLayer* weightsLayer = graph.AddLayer<ConstantLayer>("Weights"); |
| 445 | weightsLayer->m_LayerOutput = std::make_shared<ScopedTensorHandle>(weights); |
| 446 | weightsLayer->GetOutputSlot(0).SetTensorInfo(weightsLayer->m_LayerOutput->GetTensorInfo()); |
| 447 | |
| 448 | Convolution2dLayer* layer = graph.AddLayer<Convolution2dLayer>(desc, "conv2d"); |
| 449 | layer->GetOutputSlot().SetTensorInfo(outputInfo); |
| 450 | |
| 451 | Layer* output = graph.AddLayer<OutputLayer>(0, "output"); |
| 452 | |
| 453 | input->GetOutputSlot().Connect(layer->GetInputSlot(0)); |
| 454 | layer->GetOutputSlot().Connect(output->GetInputSlot(0)); |
| 455 | weightsLayer->GetOutputSlot(0).Connect(layer->GetInputSlot(1)); |
| 456 | } |
| 457 | |
| 458 | TEST_CASE("Conv2dValidateTensorShapesFromInputs") |
| 459 | { |
no test coverage detected