| 643 | } |
| 644 | |
| 645 | void Graph::InferTensorInfos() |
| 646 | { |
| 647 | for (auto&& layer : TopologicalSort()) |
| 648 | { |
| 649 | for (auto&& input : layer->GetInputSlots()) |
| 650 | { |
| 651 | const IOutputSlot* source = input.GetConnectedOutputSlot(); |
| 652 | if (source == NULL) |
| 653 | { |
| 654 | // Throws exception due to a layer input not being connected to an output slot. |
| 655 | // Verifies input slot weights and bias are set for FullyConnected layers. |
| 656 | ConstructErrorMessageForUnconnectedInputs(layer, input.GetSlotIndex()); |
| 657 | } |
| 658 | |
| 659 | if (!source->IsTensorInfoSet()) |
| 660 | { |
| 661 | std::ostringstream message; |
| 662 | message << "Output slot TensorInfo not set on " |
| 663 | << GetLayerTypeAsCString(layer->GetType()) |
| 664 | << " layer " |
| 665 | << std::quoted(layer->GetName()); |
| 666 | throw LayerValidationException(message.str()); |
| 667 | } |
| 668 | } |
| 669 | |
| 670 | if (layer->m_ShapeInferenceMethod == ShapeInferenceMethod::ValidateOnly) |
| 671 | { |
| 672 | layer->ValidateTensorShapesFromInputs(); |
| 673 | } |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | /// Throws exception due to a layer input not being connected to an output slot. |
| 678 | /// Verifies weights and bias are set for layers on input slots 1 |