import paddle # Define an array on the CPU array_on_cpu = paddle.to_tensor([1, 2, 3, 4, 5]) # Check if GPU is available use_gpu = paddle.is_compiled_with_cuda() and paddle.device.is_compiled_with_cuda() if use_gpu: # Transfer the array to GPU array_on_gpu = array_on_cpu.cuda() # Print the array on GPU print("Array on GPU:") print(array_on_gpu) # Verify the device of the tensor print("Device of the tensor:", array_on_gpu.place) else: print("CUDA is not available. Cannot load array onto GPU.")