Skip to content

Commit

Permalink
small edit to test
Browse files Browse the repository at this point in the history
  • Loading branch information
nfarabullini committed Jan 15, 2024
1 parent b2b8fa7 commit 8da1b3f
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,16 @@ def program_bound_args(a: cases.IField, scalar: int32, condition: bool, out: cas
def test_with_bound_args_order_args(cartesian_case):
@gtx.field_operator
def fieldop_args(a: cases.IField, condition: bool, scalar: int32) -> cases.IField:
if not condition:
scalar = 0
scalar = 0 if not condition else scalar
return a + scalar

@gtx.program(backend=cartesian_case.backend)
def program_args(a: cases.IField, condition: bool, scalar: int32, out: cases.IField):
fieldop_args(a, condition, scalar, out=out)

a = cases.allocate(cartesian_case, program_args, "a")()
scalar = int32(1)
ref = a.asnumpy() + scalar
out = cases.allocate(cartesian_case, program_args, "out")()

prog_bounds = program_args.with_bound_args(condition=True)
prog_bounds(a=a, scalar=scalar, out=out, offset_provider={})
np.allclose(out.asnumpy(), ref)
prog_bounds(a=a, scalar=int32(1), out=out, offset_provider={})
np.allclose(out.asnumpy(), a.asnumpy() + int32(1))

0 comments on commit 8da1b3f

Please sign in to comment.