Throws exception due to a layer input not being connected to an output slot. Verifies weights and bias are set for layers on input slots 1 and 2 respectively. Method checks if bias is enabled before ensuring it is set. @param layer constant pointer to a Layer object @param slotIndex input slot index of layer @throws LayerValidationException
| 682 | /// @param slotIndex input slot index of layer |
| 683 | /// @throws LayerValidationException |
| 684 | void Graph::ConstructErrorMessageForUnconnectedInputs(Layer* const layer, |
| 685 | unsigned int slotIndex) |
| 686 | { |
| 687 | std::ostringstream message; |
| 688 | bool noWeightsAndBias = false; |
| 689 | |
| 690 | if ((layer->GetType() == armnn::LayerType::FullyConnected || |
| 691 | layer->GetType() == armnn::LayerType::Convolution2d || |
| 692 | layer->GetType() == armnn::LayerType::Convolution3d || |
| 693 | layer->GetType() == armnn::LayerType::DepthwiseConvolution2d) && slotIndex > 0) |
| 694 | { |
| 695 | message << std::endl; |
| 696 | |
| 697 | // If weights are not set and is bias enabled, also check if bias is set |
| 698 | if (slotIndex == 1 && layer->GetNumInputSlots() == 3) |
| 699 | { |
| 700 | const IOutputSlot* biasSource = layer->GetInputSlot(2).GetConnectedOutputSlot(); |
| 701 | if (biasSource == NULL) |
| 702 | { |
| 703 | message << "Weights and bias layers not set." << std::endl; |
| 704 | noWeightsAndBias = true; |
| 705 | } |
| 706 | } |
| 707 | |
| 708 | // Only weights or bias are not set |
| 709 | if (!noWeightsAndBias) |
| 710 | { |
| 711 | if (slotIndex == 1) |
| 712 | { |
| 713 | message << "Weights layer not set." << std::endl; |
| 714 | } |
| 715 | else |
| 716 | { |
| 717 | message << "Bias layer not set." << std::endl; |
| 718 | } |
| 719 | } |
| 720 | } |
| 721 | |
| 722 | std::string slotString = noWeightsAndBias ? "1 & 2" : std::to_string(slotIndex); |
| 723 | message << "Input slot(s) " |
| 724 | << slotString |
| 725 | << " for " |
| 726 | << GetLayerTypeAsCString(layer->GetType()) |
| 727 | << " not connected to an output slot. " << std::endl |
| 728 | << "Layer name: " |
| 729 | << std::quoted(layer->GetName()); |
| 730 | throw LayerValidationException(message.str()); |
| 731 | } |
| 732 | |
| 733 | const std::shared_ptr<IProfiler>& Graph::GetProfiler() const |
| 734 | { |
nothing calls this directly
no test coverage detected