pytorch拟合一元一次函数
pytorch拟合一元一次函数1. 自定义网络2. 使用卷积网络 拟合函数y=a×x+by=a\times x+by=a×x+b,其中a=1,b=2a=1,b=2a=1,b=2。 1. 自定义网络 import torch import numpy as np class Net: def __init__(self): self.a = torch.rand(1, requires_grad=True) self.b = torch.rand(1, requires_grad=True) self.__parameters = di
下载地址
用户评论