Skip to content
Discussion options

You must be logged in to vote

Hi,
I run your code but get different errors. Note that there are double underscores on both sides of the init method. In the forward method, the argument is x, but you use X below. And, there's a typo: it's weight instead of wieght, though the result will not be affected.

Hope this helps :)

import torch
from torch import nn
import matplotlib.pyplot as plt
wieght = 0.7
bias = 0.3
start = 0
end = 1
step = 0.02
X = torch.arange(start, end, step).unsqueeze(dim=1)
y = wieght * X + bias
train_split = int(0.8 * len(X))
X_train, y_train = X[:train_split], y[:train_split]
X_test, y_test = X[train_split:], y[train_split:]

def plot_prediction(train_data = X_train,
                  train_labels = y…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@HeavenComet
Comment options

@mrdbourke
Comment options

Answer selected by HeavenComet
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants