deeplearning4j/deeplearning4j · error · NoOpNameFoundException

No onnx op opName found for setrange

Error message

No onnx op opName found for setrange

What it means

SetRange has no ONNX operator equivalent, so onnxName() throws NoOpNameFoundException for opName() "setrange". ND4J throws this whenever framework name resolution finds no registered mapping for the op.

Solutions

  1. Replace SetRange with an ONNX-representable equivalent (e.g. clip/min+max composition)
  2. Express the range operation from primitive ONNX ops before export
  3. Catch NoOpNameFoundException during export and substitute or drop the node
  4. Add a custom op mapping/subclass overriding onnxName() if your exporter supports it

Example fix

// before
SDVariable y = sd.math.setRange(x, min, max);
// after
SDVariable y = sd.math.clip(x, min, max); // clip-by-value, ONNX-mappable
Defensive patterns

Strategy: try-catch

Validate before calling

try { new SetRange().onnxName(); return true; } catch (NoOpNameFoundException e) { return false; } // use clip instead

Type guard

static boolean onnxExportable(Op op) {
    try { op.onnxName(); return true; } catch (NoOpNameFoundException e) { return false; }
}

Try / catch

try {
    exporter.addOp(op, op.onnxName());
} catch (NoOpNameFoundException e) {
    exporter.addOp(clipByValueRewrite(op)); // min(max(x,min),max)
}

Prevention

When it happens

Trigger: Calling SetRange.onnxName(); exporting a SameDiff graph containing a SetRange node to ONNX; ONNX export tooling enumerating all ops in the graph.

Common situations: ONNX conversion of models using setrange-style range-clamping transforms; custom activation pipelines built on SetRange then exported.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ops/impl/transforms/strict/SetRange.java:72

    public SetRange(INDArray x, double min, double max) {
        super(x);
        this.min = min;
        this.max = max;
        this.extraArgs = new Object[] {min, max};
    }

    @Override
    public int opNum() {
        return 25;
    }

    @Override
    public String opName() {
        return "setrange";
    }
    @Override
    public String onnxName() {
        throw new NoOpNameFoundException("No onnx op opName found for " +  opName());
    }

    @Override
    public String tensorflowName() {
        throw new NoOpNameFoundException("No tensorflow op opName found for " +  opName());
    }

    @Override
    public List<SDVariable> doDiff(List<SDVariable> f1) {
        return null;
    }
}

View on GitHub (pinned to 4c22ac5fe4)