x = torch.linspace(-5,5,200), size [200]

y=torch.linspace(x1,x2) returns a one-dimensional tensor of size 100 equally spaced points between x1 and x2.

y=torch.linspace(x1,x2,n) returns a one-dimensional tensor of n equally spaced points between x1 and x2.
This commit is contained in:
Dolly Ye
2018-02-17 22:52:07 -08:00
committed by GitHub
parent 0b09c05dc8
commit 9beffbc7eb

View File

@ -41,7 +41,7 @@
"metadata": {},
"outputs": [],
"source": [
"x = torch.linspace(-5, 5, 200) # x data (tensor), shape=(100, 1)\n",
"x = torch.linspace(-5, 5, 200) # x data (tensor), shape=(200, 1)\n",
"x = Variable(x)\n",
"x_np = x.data.numpy() # numpy array for plotting"
]