How to use the onnxmltools.convert.common.utils._check_has_attr function in onnxmltools

To help you get started, we’ve selected a few onnxmltools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github onnx / onnxmltools / onnxmltools / convert / sklearn / TreeEnsembleConverter.py View on Github external
def validate(sk_node):
        try:
            utils._check_has_attr(sk_node, 'tree_')
            utils._check_has_attr(sk_node, 'classes_')
        except AttributeError as e:
            raise RuntimeError('Missing attribute in sklearn model ' + str(e))
github onnx / onnxmltools / onnxmltools / convert / sklearn / ScalerConverter.py View on Github external
def validate(sk_node):
        try:
            utils._check_has_attr(sk_node, 'scale_')
            utils._check_has_attr(sk_node, 'mean_')
        except AttributeError as e:
            raise RuntimeError("Missing type from sklearn node:" + str(e))
        # Scikit converts zeroes in scale explicitly so all components should have non-zero values.
        if (sk_node.scale_ == 0).any():
            raise RuntimeError("The scale cannot contain any zero")
github onnx / onnxmltools / onnxmltools / convert / coreml / SupportVectorClassifierConverter.py View on Github external
def validate(cm_node):
        try:
            utils._check_has_attr(cm_node, 'supportVectorClassifier')
            utils._check_has_attr(cm_node.supportVectorClassifier, 'kernel')
            utils._check_has_attr(cm_node.supportVectorClassifier, 'numberOfSupportVectorsPerClass')
            utils._check_has_attr(cm_node.supportVectorClassifier, 'coefficients')
            utils._check_has_attr(cm_node.supportVectorClassifier.coefficients[0], 'alpha')
            utils._check_has_attr(cm_node.supportVectorClassifier, 'rho')
        except AttributeError as e:
            raise RuntimeError("Missing type from CoreML node:" + str(e))
github onnx / onnxmltools / onnxmltools / convert / sklearn / SVMConverter.py View on Github external
def validate(sk_node):
        try:
            utils._check_has_attr(sk_node, 'support_vectors_')
            utils._check_has_attr(sk_node, 'coef0')
            utils._check_has_attr(sk_node, '_gamma')
            utils._check_has_attr(sk_node, 'degree')
            utils._check_has_attr(sk_node, 'intercept_')
        except AttributeError as e:
            raise RuntimeError("Missing type from sklearn node:" + str(e))
github onnx / onnxmltools / onnxmltools / convert / coreml / SupportVectorRegressorConverter.py View on Github external
def validate(cm_node):
        try:
            utils._check_has_attr(cm_node, 'supportVectorRegressor')
            utils._check_has_attr(cm_node.supportVectorRegressor, 'kernel')
            utils._check_has_attr(cm_node.supportVectorRegressor, 'coefficients')
            utils._check_has_attr(cm_node.supportVectorRegressor.coefficients, 'alpha')
            utils._check_has_attr(cm_node.supportVectorRegressor, 'rho')
        except AttributeError as e:
            raise RuntimeError("Missing type from CoreML node:" + str(e))
github onnx / onnxmltools / onnxmltools / convert / sklearn / DictVectorizerConverter.py View on Github external
def validate(sk_node):
        try:
            utils._check_has_attr(sk_node, 'feature_names_')
        except AttributeError as e:
            raise RuntimeError("Missing type from sklearn node:" + str(e))
github onnx / onnxmltools / onnxmltools / convert / coreml / NeuralNetwork / biDirectionalLSTM.py View on Github external
def validate(cm_node):
        try:
            utils._check_has_attr(cm_node, 'biDirectionalLSTM')
            utils._check_has_attr(cm_node, 'input')
            utils._check_has_attr(cm_node, 'output')
        except AttributeError as e:
            raise RuntimeError('Missing attribute in neural network layer: {0}'.format(cm_node.name))
github onnx / onnxmltools / onnxmltools / convert / coreml / DictVectorizerConverter.py View on Github external
def validate(cm_node):
        try:
            utils._check_has_attr(cm_node, 'dictVectorizer')
        except AttributeError as e:
            raise RuntimeError('Missing type from CoreML node:' + str(e))
github onnx / onnxmltools / onnxmltools / convert / coreml / NormalizerConverter.py View on Github external
def validate(cm_node):
        try:
            utils._check_has_attr(cm_node, 'normalizer')
        except AttributeError as e:
            raise RuntimeError('Missing type from CoreML node:' + str(e))