Skip to content

Commit fa9af99

Browse files
committed
Improve readability in constructor
1 parent 9990e2b commit fa9af99

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/OperatorEnumConstruction.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,12 @@ function OperatorEnum(;
227227

228228
test_inputs = Float32.(LinRange(-100, 100, 99))
229229
# Create grid over [-100, 100]^2:
230-
test_inputs_xy = reduce(
231-
hcat, reduce(hcat, ([[[x, y] for x in test_inputs] for y in test_inputs]))
232-
)
230+
test_inputs_xy = Array{Float32}(undef, 2, 99^2)
231+
row = 1
232+
for x in test_inputs, y in test_inputs
233+
test_inputs_xy[:, row] .= [x, y]
234+
row += 1
235+
end
233236
for op in binary_operators
234237
diff_op(x, y) = gradient(op, x, y)
235238

0 commit comments

Comments
 (0)