a = shape (2, 3)
Try
Spaces or commas between values · new line = new row · blank line = new 2-D layer (3-D array).
NumPy runs here for real; PyTorch does not run in the browser. PyTorch code is shown next to it, and every PyTorch result stated here (dtypes, errors) was recorded with PyTorch 2.14.0.
Starting Python… (first visit downloads ≈ 15 MB, then it is cached)
a NumPy ndarray · runs here1
2
3
4
5
6
import torch
t = torch.tensor([[1, 2, 3],
[4, 5, 6]])Same values, same shape, same axes: a tensor is PyTorch’s n-dimensional array.
import numpy as np
a = np.array([[1, 2, 3],
[4, 5, 6]])
aOutput
Output appears here.