{
"id": "fn-gpu-transpose",
"dataComponent": "gpu",
"heading": {
"title": "transpose",
"badges": ["GPU"]
},
"synopsis": "Transposes a 2D tensor on the GPU, swapping rows and columns.",
"codeBlocks": [
"extend(\"gpu\")\n\nA = gpu:to_tensor([[1,2,3],[4,5,6]])\nsput( gpu:transpose(A) )\n# => [[1,4],[2,5],[3,6]]\n\n# Use cases:\n# 1) Reorienting matrices for multiplication or convolution.\n# 2) Converting row-major data to column-major or vice versa.\n"
],
"notes": [
"gpu:transpose expects exactly 1 Tensor. Must be 2D, shape [rows, cols].",
"Returns a new tensor with shape [cols, rows].",
"If input is not 2D, bridging may raise an error or produce unexpected results."
]
}