deeplearning4j/deeplearning4j · error · java.lang.IllegalArgumentException

Rule for framework $inputFramework does not accept input…

Error message

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}

What it means

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.

Solutions

  1. Check the failing model's node attribute type for the named attribute and use a rule variant that accepts that type.
  2. Add the value type to the rule's accepted input types if conversion is actually supported.
  3. Coerce/convert the attribute before mapping (e.g. wrap scalar in a tensor attribute or vice versa) in a pre-processing transform.
  4. Inspect inputType in the message and compare with the rule's accepts().allowedTypes; fix the rule definition to match the model's attribute type.

Example fix

// before: rule only accepts ATTRIBUTE_TYPE.INT but model has FLOAT
valueMapping(INTToINT(), "axis")
// after
valueMapping(FLOATToFLOAT(), "axis") // or convert attribute to INT upstream
Defensive patterns

Strategy: validation

Validate before calling

attributeMappingRule.mappingNamesToPerform().forEach { (_, inputName) ->
    val t = attributeMappingRule.attributeValueTypeFor(inputName, mappingProcess)
    require(attributeMappingRule.acceptsInputType(t)) { "$inputName has type $t, not accepted by ${attributeMappingRule.name()}" }
}

Try / catch

try {
    process.applyProcess()
} catch (e: IllegalArgumentException) {
    if (e.message?.contains("does not accept input type") == true) fallbackToDifferentRule(e) else throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


AI-assisted analysis of deeplearning4j/deeplearning4j@4c22ac5fe4 (2026-09-07). Data as JSON: /api/errors/a9b5189cf5de42ff. Report an issue: GitHub.

Appendix: source

Thrown at nd4j/samediff-import/samediff-import-api/src/main/kotlin/org/nd4j/samediff/frameworkimport/process/AbstractMappingProcess.kt:104

                    throw IllegalArgumentException(
                        "Found invalid output tensor named ${nd4jName} for rule ${tensorMappingRule.name()} and mapping process for op ${opName} and input framework name ${inputFrameworkOpName} with definition being ${
                            nd4jOpDescriptors.findOp(
                                opName
                            )
                        }"
                    )
                }

            }
        }

        attributeMappingRules.forEach {
            it.initWithMappingProcess(this)
            attributeMappingRules.forEach { attributeMappingRule ->
                attributeMappingRule.mappingNamesToPerform().forEach { (nd4jName, inputFrameworkName) ->
                    val inputType = attributeMappingRule.attributeValueTypeFor(inputFrameworkName,this)
                    if(!attributeMappingRule.acceptsInputType(inputType)) {
                        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}")
                    }

                    val outputType = attributeMappingRule.argDescriptorTypesForOutputName(nd4jName,this)
                    if(!attributeMappingRule.outputsType(outputType)) {
                        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}")
                    }

                }
            }
        }


        opMappingRegistry.registerMappingProcess(
            inputFrameworkOpName = inputFrameworkOpName,
            processToRegister = this
        )

View on GitHub (pinned to 4c22ac5fe4)