{
"id": "fn-gpu-to_array",
"dataComponent": "gpu",
"heading": {
"title": "to_array",
"badges": ["GPU"]
},
"synopsis": "Converts a rank=2 float32 TensorValue back into a float2D_array in Mu’s script environment. Errors if shape is not 2D.",
"codeBlocks": [
"extend(\"gpu\")\\n\\n# 1) Suppose T is shape [3×2]\\nmyTensor = gpu:to_tensor([[1,2],[3,4],[5,6]])\\narr = gpu:to_array(myTensor)\\nslog(arr)\\n# => Float2DArray([[1.0,2.0],[3.0,4.0],[5.0,6.0]])\\n\\n# 2) If the input is not rank=2 or not float32, bridging logs an error.\\n# 3) This is typically the final step after a GPU operation, retrieving results for printing or further script logic.\\n"
],
"notes": [
"Requires exactly 1 argument: a Value::Tensor with elem_type=Float32 and shape=[rows, cols].",
"Returns a float2D_array by reading each row from the data buffer.",
"If bridging sees shape != 2D, or the data is not float32, an error is raised. This function is a standard finishing step after GPU-based transforms."
]
}