Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[#17877][FRONTEND][ONNX] Fix tvm.error.InternalError: Check failed: (…
…ptr) is false: The struct_info is not populated, check if you have normalized the expr
  • Loading branch information
cchung100m committed Oct 7, 2025
commit a68615179047b3ac6c970670b794e424190caeea
14 changes: 7 additions & 7 deletions python/tvm/relax/frontend/onnx/onnx_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ def _impl_v1(cls, bb, inputs, attr, params):
bias = inputs[1]
bias_shape = bias.struct_info.shape
assert len(bias_shape) == 1, "bias term must be a 1D tensor"
x = relax.op.add(x, bias)
x = bb.emit(relax.op.add(x, bias))

# Declare consts
const_dtype = x.struct_info.dtype
Expand All @@ -1170,13 +1170,13 @@ def _impl_v1(cls, bb, inputs, attr, params):
const2 = relax.const(0.044715 * math.sqrt(2 / math.pi), dtype=const_dtype)

# Compute FastGelu
term1 = relax.op.multiply(half, x)
term2 = relax.op.multiply(const1, x)
term1 = bb.emit(relax.op.multiply(half, x))
term2 = bb.emit(relax.op.multiply(const1, x))
# use x^3 = x * x * x instead of pow(x, 3) for better performance
x_cubed = relax.op.multiply(relax.op.multiply(x, x), x)
term3 = relax.op.multiply(const2, x_cubed)
tanh = relax.op.tanh(relax.op.add(term2, term3))
return relax.op.multiply(term1, relax.op.add(one, tanh))
x_cubed = bb.emit(relax.op.multiply(relax.op.multiply(x, x), x))
term3 = bb.emit(relax.op.multiply(const2, x_cubed))
tanh = bb.emit(relax.op.tanh(relax.op.add(term2, term3)))
return bb.emit(relax.op.multiply(term1, relax.op.add(one, tanh)))


class BiasGelu(OnnxOpConverter):
Expand Down
Loading