| 47 | } |
| 48 | |
| 49 | void ExecuteNetworkParams::ValidateParams() |
| 50 | { |
| 51 | if (m_DynamicBackendsPath == "") |
| 52 | { |
| 53 | // Check compute devices are valid unless they are dynamically loaded at runtime |
| 54 | std::string invalidBackends; |
| 55 | if (!CheckRequestedBackendsAreValid(m_ComputeDevices, armnn::Optional<std::string&>(invalidBackends))) |
| 56 | { |
| 57 | ARMNN_LOG(fatal) << "The list of preferred devices contains invalid backend IDs: " |
| 58 | << invalidBackends; |
| 59 | } |
| 60 | } |
| 61 | CheckClTuningParameter(m_TuningLevel, m_TuningPath, m_ComputeDevices); |
| 62 | |
| 63 | if (m_EnableBf16TurboMode && !m_EnableFastMath) |
| 64 | { |
| 65 | throw armnn::InvalidArgumentException("To use BF16 please use --enable-fast-math. "); |
| 66 | } |
| 67 | |
| 68 | // Check input tensor shapes |
| 69 | if ((m_InputTensorShapes.size() != 0) && |
| 70 | (m_InputTensorShapes.size() != m_InputNames.size())) |
| 71 | { |
| 72 | throw armnn::InvalidArgumentException("input-name and input-tensor-shape must have " |
| 73 | "the same amount of elements. "); |
| 74 | } |
| 75 | |
| 76 | if (m_InputTensorDataFilePaths.size() != 0) |
| 77 | { |
| 78 | if (!ValidatePaths(m_InputTensorDataFilePaths, true)) |
| 79 | { |
| 80 | throw armnn::InvalidArgumentException("One or more input data file paths are not valid."); |
| 81 | } |
| 82 | |
| 83 | if (m_InputTensorDataFilePaths.size() < m_InputNames.size()) |
| 84 | { |
| 85 | throw armnn::InvalidArgumentException( |
| 86 | fmt::format("According to the number of input names the user provided the network has {} " |
| 87 | "inputs. But only {} input-tensor-data file paths were provided. Each input of the " |
| 88 | "model is expected to be stored in it's own file.", |
| 89 | m_InputNames.size(), |
| 90 | m_InputTensorDataFilePaths.size())); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | // Check that threshold time is not less than zero |
| 95 | if (m_ThresholdTime < 0) |
| 96 | { |
| 97 | throw armnn::InvalidArgumentException("Threshold time supplied as a command line argument is less than zero."); |
| 98 | } |
| 99 | |
| 100 | // Warn if ExecuteNetwork will generate dummy input data |
| 101 | if (m_GenerateTensorData) |
| 102 | { |
| 103 | ARMNN_LOG(warning) << "No input files provided, input tensors will be filled with 0s."; |
| 104 | } |
| 105 | |
| 106 | if (m_AllowExpandedDims && m_InferOutputShape) |
no test coverage detected