import torch from model import LinearModel def predict(x_value): model = LinearModel() model.load_state_dict(torch.load("models/model.pt")) model.eval() x = torch.tensor([[x_value]], dtype=torch.float32) y = model(x) print(f"Input: {x_value} | Prediction: {y.item()}") def actual(x): return 2 * x + 3 if __name__ == "__main__": predict(4.0) print(f"Actual: {actual(4.0)}")