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:
@ -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"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user