def stackoverflow_49()

in Synthesis_incorporation/benchmarks/stackoverflow_benchmarks.py [0:0]


def stackoverflow_49():
    examples = [
        benchmark.Example(
            inputs=[
                # Shape = [3, 1, 2, 3].
                # [
                #     [[[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]]],
                #     [[[0.8, 1.0, 0.0], [0.6, 0.4, 0.2]]],
                #     [[[0.9, 0.8, 0.7], [0.1, 0.2, 0.3]]],
                # ],
                [
                    [[[1, 2, 3], [4, 5, 6]]],
                    [[[8, 10, 0], [6, 4, 2]]],
                    [[[9, 8, 7], [1, 2, 3]]],
                ],
                # [2.0, 0.5, 1.0],
                [20, 5, 10]
            ],
            output=[
                [[[20, 40, 60], [80, 100, 120]]],
                [[[40, 50, 0], [30, 20, 10]]],
                [[[90, 80, 70], [10, 20, 30]]],
                # [[[0.2, 0.4, 0.6], [0.8, 1.0, 1.2]]],
                # [[[0.4, 0.5, 0.0], [0.3, 0.2, 0.1]]],
                # [[[0.9, 0.8, 0.7], [0.1, 0.2, 0.3]]],
            ],
        ),
    ]
    constants = []
    description = "multiply tensors by scalars in a batched way"
    target_program = "torch.transpose(torch.mul(in2, torch.transpose(in1, 0, 3)), 0, 3)"
    source = "https://stackoverflow.com/questions/58466562/given-a-batch-of-n-images-how-to-scalar-multiply-each-image-by-a-different-scal"
    return benchmark.Benchmark(
        examples=examples,
        constants=constants,
        description=description,
        target_program=target_program,
        source=source,
        name="stackoverflow_49",
    )