def stackoverflow_19()

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


def stackoverflow_19():
    examples = [
        benchmark.Example(
            inputs=[
                [
                    [3, 1, 2],
                    [1, 0, 4],
                    [1, 2, 3],
                    [0, 5, 1],
                    [1, 1, 2],
                    [2, 3, 1],
                    [2, 1, 0],
                ],
            ],
            output=[
                [0, 5, 1],
                [1, 0, 4],
                [1, 1, 2],
                [1, 2, 3],
                [2, 1, 0],
                [2, 3, 1],
                [3, 1, 2],
            ],
        ),
    ]
    constants = []
    description = (
        "sort a tensor considering the first column, breaking ties "
        "using the second column"
    )
    target_program = """
  second_sorted = in1[torch.sort(in1[:, 1])[1]]
  solution = second_sorted[torch.sort(second_sorted[:, 0])[1]]
  """
    source = "https://stackoverflow.com/questions/49399198/sort-a-tensor-based-on-two-columns-in-tensorflow"
    return benchmark.Benchmark(
        examples=examples,
        constants=constants,
        description=description,
        target_program=target_program,
        source=source,
        name="stackoverflow_19",
    )