mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-10 21:40:02 +00:00
[Gemini] patch for supporting orch.add_ function for ColoTensor (#2003)
This commit is contained in:
@@ -16,14 +16,14 @@ class InlineOpModule(CheckpointModule):
|
||||
def __init__(self, checkpoint=False) -> None:
|
||||
super().__init__(checkpoint=checkpoint)
|
||||
self.proj1 = nn.Linear(4, 8)
|
||||
self.weight = nn.Parameter(torch.randn(8, 8))
|
||||
self.proj2 = nn.Linear(8, 4)
|
||||
self.proj2 = nn.Linear(8, 8)
|
||||
|
||||
def forward(self, x):
|
||||
|
||||
x = self.proj1(x)
|
||||
# inline add_
|
||||
x.add_(10)
|
||||
x = F.linear(x, self.weight)
|
||||
x = self.proj2(x)
|
||||
# inline relu_
|
||||
x = torch.relu_(x)
|
||||
x = self.proj2(x)
|
||||
|
Reference in New Issue
Block a user