{"task": {"agent_timeout": 1800, "task": "945", "verifier_timeout": 1800, "instruction": "# 945: DS-1000 Task\n\n## Prompt\nProblem:\n\nI'm trying to slice a PyTorch tensor using a logical index on the columns. I want the columns that correspond to a 1 value in the index vector. Both slicing and logical indexing are possible, but are they possible together? If so, how? My attempt keeps throwing the unhelpful error\n\nTypeError: indexing a tensor with an object of type ByteTensor. The only supported types are integers, slices, numpy scalars and torch.LongTensor or torch.ByteTensor as the only argument.\n\nMCVE\nDesired Output\n\nimport torch\n\nC = torch.LongTensor([[1, 3], [4, 6]])\n# 1 3\n# 4 6\nLogical indexing on the columns only:\n\nA_log = torch.ByteTensor([1, 0, 1]) # the logical index\nB = torch.LongTensor([[1, 2, 3], [4, 5, 6]])\nC = B[:, A_log] # Throws error\nIf the vectors are the same size, logical indexing works:\n\nB_truncated = torch.LongTensor([1, 2, 3])\nC = B_truncated[A_log]\n\n\nA:\n\n<code>\nimport numpy as np\nimport pandas as pd\nimport torch\nA_log, B = load_data()\ndef solve(A_log, B):\n    # return the solution in this function\n    # C = solve(A_log, B)\n    ### BEGIN SOLUTION\n\n## What to do\n- Edit `solution/solution.py` so the code passes the DS-1000 tests.\n- Do not access the internet or install new packages; required libraries are preinstalled in the Docker image.\n- Run tests locally via `bash tests/test.sh`.\n\n## Notes\n- Keep the variable names/signatures implied by the prompt/code_context.\n- The evaluator uses the original DS-1000 `code_context` (`test_execution` / `test_string`).\n", "memory": "", "runnable": false, "difficulty": "", "language": "", "cpus": "", "instruction_truncated": false, "category": "", "compose": false, "has_solution": true, "oracle": null, "docker_image": "ds1000:latest", "taskset": "ds1000", "tags": []}, "runs": []}