in Synthesis_incorporation/benchmarks/stackoverflow_benchmarks.py [0:0]
def stackoverflow_39():
examples = [
benchmark.Example(
inputs=[
# [[-1.5, 1.0, 0.9, 2.0], [1.1, 0.0, -0.1, -0.9], [-1.0, 0.1, -1.1, 2.5]],
[[15, 10, 9, 20], [11, 0, 1, 9], [10, 1, 11, 25]]
],
output=[
[225, 100, 81, 400],
[121, 0, 1, 81],
[100, 1, 121, 625],
# [2.25, 1.0, 0.0, 4.0],
# [1.21, 0.0, 0.0, 0.0],
# [1.0, 0.0, 1.21, 6.25],
],
),
]
constants = []
description = (
"set to 0 the elements with absolute value less than 1, and "
"square the other elements"
)
target_program = (
"torch.square(torch.where(torch.lt(torch.abs(in1), 1), torch.tensor(0.), in1))"
)
source = "https://stackoverflow.com/questions/37912161/how-can-i-compute-element-wise-conditionals-on-batches-in-tensorflow"
return benchmark.Benchmark(
examples=examples,
constants=constants,
description=description,
target_program=target_program,
source=source,
name="stackoverflow_39",
)