"vscode:/vscode.git/clone" did not exist on "26d1a5daccc3949e0acd89499cc9fc6dc3504eb3"
Commit 598cde4a authored by Zirui Zhu's avatar Zirui Zhu Committed by binmakeswell
Browse files

[NFC] polish colossalai/nn/layer/parallel_2p5d/layers.py code style (#972)

parent 632e94ab
...@@ -189,7 +189,7 @@ class Linear2p5D(ParallelLayer): ...@@ -189,7 +189,7 @@ class Linear2p5D(ParallelLayer):
def forward(self, x: Tensor) -> Tensor: def forward(self, x: Tensor) -> Tensor:
# input: [m/dq, n/q, k/q] # input: [m/dq, n/q, k/q]
# output: [m/dq, n/q, h/q] # output: [m/dq, n/q, h/q]
out_shape = x.shape[:-1] + (self.hidden_size_per_partition, ) out_shape = x.shape[:-1] + (self.hidden_size_per_partition,)
output = Matmul_AB_2p5D.apply( output = Matmul_AB_2p5D.apply(
x, x,
...@@ -1038,7 +1038,7 @@ class Classifier2p5D(ParallelLayer): ...@@ -1038,7 +1038,7 @@ class Classifier2p5D(ParallelLayer):
destination.update(local_state) destination.update(local_state)
def forward(self, input_: Tensor) -> Tensor: def forward(self, input_: Tensor) -> Tensor:
out_shape = input_.shape[:-1] + (self.num_classes, ) out_shape = input_.shape[:-1] + (self.num_classes,)
return classifier_2p5d(input_, self.weight, self.bias, self.tesseract_dim, out_shape, self.row_rank, return classifier_2p5d(input_, self.weight, self.bias, self.tesseract_dim, out_shape, self.row_rank,
self.col_rank, ParallelMode.PARALLEL_2P5D_ROW, ParallelMode.PARALLEL_2P5D_COL, self.col_rank, ParallelMode.PARALLEL_2P5D_ROW, ParallelMode.PARALLEL_2P5D_COL,
...@@ -1172,7 +1172,7 @@ class VocabParallelClassifier2p5D(ParallelLayer): ...@@ -1172,7 +1172,7 @@ class VocabParallelClassifier2p5D(ParallelLayer):
def forward(self, x: Tensor) -> Tensor: def forward(self, x: Tensor) -> Tensor:
# input: [m/dq, n/q, k/q] # input: [m/dq, n/q, k/q]
# output: [m/dq, n/q, h/q] # output: [m/dq, n/q, h/q]
out_shape = x.shape[:-1] + (self.hidden_size_per_partition, ) out_shape = x.shape[:-1] + (self.hidden_size_per_partition,)
output = Matmul_ABT_2p5D.apply( output = Matmul_ABT_2p5D.apply(
x, x,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment