in Synthesis_incorporation/benchmarks/stackoverflow_benchmarks.py [0:0]
def stackoverflow_47():
examples = [
benchmark.Example(
inputs=[
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
[
[True, True, True, False, False],
[True, True, False, False, False],
[True, True, True, True, True],
[True, True, True, True, False],
[True, False, False, False, False],
[True, True, False, False, False],
],
],
output=[
[0, 1, 2, 0, 0],
[3, 4, 0, 0, 0],
[5, 6, 7, 8, 9],
[10, 11, 12, 13, 0],
[14, 0, 0, 0, 0],
[15, 16, 0, 0, 0],
],
),
]
constants = []
description = "put given values into a sequence mask"
target_program = """
mask = torch.reshape(in2, [-1])
solution = torch.reshape(torch.where(mask, torch.sub(torch.cumsum(mask, 0), 1), torch.tensor(0)), in2.size())
"""
source = "https://stackoverflow.com/questions/58641546/how-can-i-put-the-sequential-values-to-the-sequence-mask"
return benchmark.Benchmark(
examples=examples,
constants=constants,
description=description,
target_program=target_program,
source=source,
name="stackoverflow_47",
)