{"record":{"id":"a9b5189cf5de42ff","repo":"deeplearning4j/deeplearning4j","slug":"rule-attributemappingrule-name-for-framework","errorCode":null,"errorMessage":"Rule ${attributeMappingRule.name()} for framework $inputFramework does not accept input type ${inputType} for attribute name ${inputFrameworkName} and mapping process for op ${opName} and input framework name ${inputFrameworkOpName}","messagePattern":"Rule (.+?) for framework \\$inputFramework does not accept input type (.+?) for attribute name (.+?) and mapping process for op (.+?) and input framework name (.+?)","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"nd4j/samediff-import/samediff-import-api/src/main/kotlin/org/nd4j/samediff/frameworkimport/process/AbstractMappingProcess.kt","lineNumber":104,"sourceCode":"                    throw IllegalArgumentException(\n                        \"Found invalid output tensor named ${nd4jName} for rule ${tensorMappingRule.name()} and mapping process for op ${opName} and input framework name ${inputFrameworkOpName} with definition being ${\n                            nd4jOpDescriptors.findOp(\n                                opName\n                            )\n                        }\"\n                    )\n                }\n\n            }\n        }\n\n        attributeMappingRules.forEach {\n            it.initWithMappingProcess(this)\n            attributeMappingRules.forEach { attributeMappingRule ->\n                attributeMappingRule.mappingNamesToPerform().forEach { (nd4jName, inputFrameworkName) ->\n                    val inputType = attributeMappingRule.attributeValueTypeFor(inputFrameworkName,this)\n                    if(!attributeMappingRule.acceptsInputType(inputType)) {\n                        throw IllegalArgumentException(\"Rule ${attributeMappingRule.name()} for framework $inputFramework does not accept input type ${inputType} for attribute name ${inputFrameworkName} and mapping process for op ${opName} and input framework name ${inputFrameworkOpName}\")\n                    }\n\n                    val outputType = attributeMappingRule.argDescriptorTypesForOutputName(nd4jName,this)\n                    if(!attributeMappingRule.outputsType(outputType)) {\n                        throw IllegalArgumentException(\"Rule ${attributeMappingRule.name()} for framework $inputFramework with input framework name $inputFrameworkName and framework op name $inputFrameworkOpName does not accept output type ${outputType} for attribute name ${nd4jName} and mapping process for op ${opName}\")\n                    }\n\n                }\n            }\n        }\n\n\n        opMappingRegistry.registerMappingProcess(\n            inputFrameworkOpName = inputFrameworkOpName,\n            processToRegister = this\n        )\n\n","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/deeplearning4j/deeplearning4j/blob/4c22ac5fe4a8350d05d224e7f4499429f7f69c93/nd4j/samediff-import/samediff-import-api/src/main/kotlin/org/nd4j/samediff/frameworkimport/process/AbstractMappingProcess.kt#L86-L122","documentation":"Thrown in AbstractMappingProcess's attribute-rule validation loop. For each mapped attribute (nd4jName -> inputFrameworkName), the rule's expected attribute value type for the framework input (attributeValueTypeFor) is checked with acceptsInputType(). If the actual attribute type in the source graph is not one the rule accepts, the rule cannot convert it and IllegalArgumentException is thrown.","triggerScenarios":"A mapping process runs (or is validated) where an attribute in the input framework graph (e.g. an ONNX/TF node attribute) has a type (INT vs FLOAT vs TENSOR vs STRING/ATTRIBUTE_TYPE) different from the types the AttributeMappingRule accepts for that attribute name.","commonSituations":"A model export produced an attribute of unexpected type (e.g. float where int expected); rules written for one exporter version encounter models from another; a rule like convertNDArrayToNDArrayInput receives a non-tensor attribute; generic ops with polymorphic attributes.","solutions":["Check the failing model's node attribute type for the named attribute and use a rule variant that accepts that type.","Add the value type to the rule's accepted input types if conversion is actually supported.","Coerce/convert the attribute before mapping (e.g. wrap scalar in a tensor attribute or vice versa) in a pre-processing transform.","Inspect inputType in the message and compare with the rule's accepts().allowedTypes; fix the rule definition to match the model's attribute type."],"exampleFix":"// before: rule only accepts ATTRIBUTE_TYPE.INT but model has FLOAT\nvalueMapping(INTToINT(), \"axis\")\n// after\nvalueMapping(FLOATToFLOAT(), \"axis\") // or convert attribute to INT upstream","handlingStrategy":"validation","validationCode":"attributeMappingRule.mappingNamesToPerform().forEach { (_, inputName) ->\n    val t = attributeMappingRule.attributeValueTypeFor(inputName, mappingProcess)\n    require(attributeMappingRule.acceptsInputType(t)) { \"$inputName has type $t, not accepted by ${attributeMappingRule.name()}\" }\n}","typeGuard":null,"tryCatchPattern":"try {\n    process.applyProcess()\n} catch (e: IllegalArgumentException) {\n    if (e.message?.contains(\"does not accept input type\") == true) fallbackToDifferentRule(e) else throw e\n}","preventionTips":["Inspect representative model files' attribute types before writing rules.","Prefer rules that accept multiple attribute value types for polymorphic ops.","Add pre-import transforms that normalize attribute types."],"tags":["kotlin","nd4j","model-import","attribute-type"],"backgroundTag":"type-mismatch","analyzedSha":"4c22ac5fe4a8350d05d224e7f4499429f7f69c93","analyzedAt":"2026-09-07T05:27:04.714Z","contentChangedAt":"2026-09-07T05:27:04.714Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}