diff --git a/.gitignore b/.gitignore index e5ea43dda1308f2817d718324ba06721d7d8d511..f492b0da4fa3769f638349a6e6b1222f87ac374a 100644 --- a/.gitignore +++ b/.gitignore @@ -135,4 +135,4 @@ $RECYCLE.BIN/ .DS_Store? ._* .Spotlight-V100 -.Trashes \ No newline at end of file +.Trashes._logger_ diff --git a/hello-world/checkpoint_epoch0.pth b/hello-world/checkpoint_epoch0.pth index deb132b204f2d7670ec67cfb741f3f27fa8ee2bc..a6ac4c80d00e448a1aaeb87c044f01b6c0202869 100644 Binary files a/hello-world/checkpoint_epoch0.pth and b/hello-world/checkpoint_epoch0.pth differ diff --git a/hello-world/checkpoint_epoch4.pth b/hello-world/checkpoint_epoch4.pth index 50f30235e748e9c6a599e339bfa77281c31a4268..0575140bca3533bda2c500f2d6ea75d96b2f1934 100644 Binary files a/hello-world/checkpoint_epoch4.pth and b/hello-world/checkpoint_epoch4.pth differ diff --git a/hello-world/main.py b/hello-world/main.py index 1e366010f1d0c99174d816da2b93de373c4f3aca..4c7c6e56a217643a7afe33ad8f9ed0cbd5da53f5 100644 --- a/hello-world/main.py +++ b/hello-world/main.py @@ -1,6 +1,11 @@ -import torch import numpy as np -np_array = np.array([1, 2, 3]) -tensor = torch.from_numpy(np_array) -print(tensor) \ No newline at end of file +# 定义矩阵 A 和向量 b +A = np.array([[1, 1], [1, 2], [1, 3]]) # 设计矩阵(3x2) +b = np.array([1, 2, 2]) # 观测值(3x1) + +# 求解最小二乘问题 +x, residuals, rank, singular_values = np.linalg.lstsq(A, b, rcond=None) + +print("最优解 x:", x) +print("残差平方和:", residuals) \ No newline at end of file