import oneflow as torch class TinyModel(torch.nn.Module):
def __init__(self):
super(TinyModel, self).__init__()
self.linear1 = torch.nn.Linear(100, 200)
self.activation = torch.nn.ReLU()
self.linear2 = torch.nn.Linear(200, 10)
self.softmax = torch.nn.Softmax()
def forward(self, x):
x = self.linear1(x)
x = self.activation(x)
x = self.linear2(x)
x = self.softmax(x)
return xtinymodel = TinyModel()print('The model:')print(tinymodel)
output = flow.relu(input)
为例,梳理一个op从Python -> C++执行的完整过程。

下面,将分别详细从源码角度跟踪其各个环节。
内容中包含的图片若涉及版权问题,请及时与我们联系删除
评论
沙发等你来抢