Skip to content

Commit 6cdc337

Browse files
authored
check valid shape on Ops.reshape (#2837)
1 parent 76785ee commit 6cdc337

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/Ops.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,8 @@ end
650650
dims::Vector{Int};
651651
location=mlir_stacktrace("reshape", @__FILE__, @__LINE__),
652652
) where {T,N}
653+
@assert length(x) == prod(dims)
654+
653655
# HLO reshape semantics collapse the opposite way
654656
res1 = transpose(x, Int64[N:-1:1...])
655657
restype = mlir_type(TracedRArray{T,length(dims)}, collect(Int64, Base.reverse(dims)))

0 commit comments

Comments
 (0)