src/unity/toolkits/coreml_export/MLModel/src/NeuralNetworkValidator.cpp
// Min and max are the minimum and maximum number of possible inputs.
// negative values are interpreted as no bound
Min and max are the minimum and maximum number of possible inputs.
negative values are interpreted as no bound
Min and max are the minimum and maximum number of possible inputs . negative values are interpreted as no bound
static Result validateInputCount(const Specification::NeuralNetworkLayer& layer, int min, int max) {
        assert( min <= max || max < 0 );
        std::string err;
        if (max > 0 && max == min && layer.input_size() != max) {
            err = "Layer " + layer.name() + " of type " + std::to_string(layer.layer_case()) + " has " + std::to_string(layer.input_size()) + " inputs, but needs exactly " + std::to_string(min) + ".";
            return Result(ResultType::INVALID_MODEL_PARAMETERS, err);
        }
        else if (min > 0 && layer.input_size() < min) {
            err = "Layer " + layer.name() + " of type " + std::to_string(layer.layer_case()) + + " has " + std::to_string(layer.input_size()) + " inputs, but needs at least " + std::to_string(min) + ".";
            return Result(ResultType::INVALID_MODEL_PARAMETERS, err);
        }
        else if (max > 0 && layer.input_size() > max) {
            err = "Layer " + layer.name() + " of type " + std::to_string(layer.layer_case()) + + " has " + std::to_string(layer.input_size()) + " inputs, but requires at least " + std::to_string(max) + ".";
            return Result(ResultType::INVALID_MODEL_PARAMETERS, err);
        }
        else {
            return Result();
        }
    }
static Result validateInputCount ( const Specification :: NeuralNetworkLayer & layer , int min , int max ) { assert ( min <= max || max < 0 ) ; std :: string err ; if ( max > 0 && max == min && layer . input_size ( ) != max ) { err = " " + layer . name ( ) + " " + std :: to_string ( layer . layer_case ( ) ) + " " + std :: to_string ( layer . input_size ( ) ) + " " + std :: to_string ( min ) + " " ; return Result ( ResultType :: INVALID_MODEL_PARAMETERS , err ) ; } else if ( min > 0 && layer . input_size ( ) < min ) { err = " " + layer . name ( ) + " " + std :: to_string ( layer . layer_case ( ) ) + + " " + std :: to_string ( layer . input_size ( ) ) + " " + std :: to_string ( min ) + " " ; return Result ( ResultType :: INVALID_MODEL_PARAMETERS , err ) ; } else if ( max > 0 && layer . input_size ( ) > max ) { err = " " + layer . name ( ) + " " + std :: to_string ( layer . layer_case ( ) ) + + " " + std :: to_string ( layer . input_size ( ) ) + " " + std :: to_string ( max ) + " " ; return Result ( ResultType :: INVALID_MODEL_PARAMETERS , err ) ; } else { return Result ( ) ; } }
Min and max are the minimum and maximum number of possible inputs.
Min and max are the minimum and maximum number of possible inputs .