in Synthesis_incorporation/benchmarks/stackoverflow_benchmarks.py [0:0]
def stackoverflow_23():
# Simplified slightly because the user already knows how to do the mod part.
examples = [
benchmark.Example(
inputs=[
[[0, 5, 2], [3, 1, 4], [5, 1, 5]],
],
output=[
[1, 0, 1, 0, 0, 1, 0, 0, 0],
[0, 1, 0, 1, 1, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 1, 0, 0, 0],
],
),
]
constants = []
description = "place 1 at the indices in the input tensor"
target_program = (
"torch.max(torch.nn.functional.one_hot(in1, 9), 1, keepdim=False, out=None)[0]"
)
source = (
"https://stackoverflow.com/questions/53414433/tensorflow-tensor-binarization"
)
return benchmark.Benchmark(
examples=examples,
constants=constants,
description=description,
target_program=target_program,
source=source,
name="stackoverflow_23",
)