Skip to content

Commit a1244cc

Browse files
committed
Enforces double quotes (") for all Python strings, replacing single quotes (').
This PR standardizes all Python strings to use double quotes (") consistently instead of single quotes ('). PR: USTC-KnowledgeComputingLab/qmb#21 Signed-off-by: Hao Zhang <[email protected]>
2 parents 402ba75 + 6204483 commit a1244cc

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ We use the git flow mode to merge the pull requests.
2424
Please provide the essential information with proper formatting in the git commit message and the pull request description.
2525

2626
Please make sure that your code is properly formatted, linted and typed when you submit a pull request.
27+
In Python code conventions, use double quotes (") for string literals and single quotes (') for character literals.
2728
The comments in the code are expected to be enough for other developers to understand your code.
2829
Please add docstrings to the code in NumPy style.
2930
If necessary, please update documentations and add tests for your changes.

qmb/attention.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ def __init__( # pylint: disable=too-many-arguments
114114
self.norm2: torch.nn.Module = torch.nn.LayerNorm(embedding_dim)
115115

116116
self.bias: torch.Tensor
117-
self.register_buffer('bias', torch.zeros([self.routed_num]))
117+
self.register_buffer("bias", torch.zeros([self.routed_num]))
118118
self.accumulater: torch.Tensor
119-
self.register_buffer('accumulater', torch.zeros([self.routed_num]))
119+
self.register_buffer("accumulater", torch.zeros([self.routed_num]))
120120
self.count: torch.Tensor
121-
self.register_buffer('count', torch.zeros([]))
121+
self.register_buffer("count", torch.zeros([]))
122122

123123
def forward(
124124
self,
@@ -320,9 +320,9 @@ def __init__( # pylint: disable=too-many-arguments
320320
if isinstance(ordering, int) and ordering == -1:
321321
ordering = list(reversed(range(self.sites)))
322322
self.ordering: torch.Tensor
323-
self.register_buffer('ordering', torch.tensor(ordering, dtype=torch.int64))
323+
self.register_buffer("ordering", torch.tensor(ordering, dtype=torch.int64))
324324
self.ordering_reversed: torch.Tensor
325-
self.register_buffer('ordering_reversed', torch.scatter(torch.zeros(self.sites, dtype=torch.int64), 0, self.ordering, torch.arange(self.sites, dtype=torch.int64)))
325+
self.register_buffer("ordering_reversed", torch.scatter(torch.zeros(self.sites, dtype=torch.int64), 0, self.ordering, torch.arange(self.sites, dtype=torch.int64)))
326326

327327
# Dummy Parameter for Device and Dtype Retrieval
328328
# This parameter is used to infer the device and dtype of the model.
@@ -653,9 +653,9 @@ def __init__( # pylint: disable=too-many-arguments
653653
if isinstance(ordering, int) and ordering == -1:
654654
ordering = list(reversed(range(self.sites)))
655655
self.ordering: torch.Tensor
656-
self.register_buffer('ordering', torch.tensor(ordering, dtype=torch.int64))
656+
self.register_buffer("ordering", torch.tensor(ordering, dtype=torch.int64))
657657
self.ordering_reversed: torch.Tensor
658-
self.register_buffer('ordering_reversed', torch.scatter(torch.zeros(self.sites, dtype=torch.int64), 0, self.ordering, torch.arange(self.sites, dtype=torch.int64)))
658+
self.register_buffer("ordering_reversed", torch.scatter(torch.zeros(self.sites, dtype=torch.int64), 0, self.ordering, torch.arange(self.sites, dtype=torch.int64)))
659659

660660
# Dummy Parameter for Device and Dtype Retrieval
661661
# This parameter is used to infer the device and dtype of the model.

qmb/crossmlp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ def __init__( # pylint: disable=too-many-arguments
103103
if isinstance(ordering, int) and ordering == -1:
104104
ordering = list(reversed(range(self.sites)))
105105
self.ordering: torch.Tensor
106-
self.register_buffer('ordering', torch.tensor(ordering, dtype=torch.int64))
106+
self.register_buffer("ordering", torch.tensor(ordering, dtype=torch.int64))
107107
self.ordering_reversed: torch.Tensor
108-
self.register_buffer('ordering_reversed', torch.scatter(torch.zeros(self.sites, dtype=torch.int64), 0, self.ordering, torch.arange(self.sites, dtype=torch.int64)))
108+
self.register_buffer("ordering_reversed", torch.scatter(torch.zeros(self.sites, dtype=torch.int64), 0, self.ordering, torch.arange(self.sites, dtype=torch.int64)))
109109

110110
# Dummy Parameter for Device and Dtype Retrieval
111111
# This parameter is used to infer the device and dtype of the model.

qmb/mlp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ def __init__( # pylint: disable=too-many-arguments
101101
if isinstance(ordering, int) and ordering == -1:
102102
ordering = list(reversed(range(self.sites)))
103103
self.ordering: torch.Tensor
104-
self.register_buffer('ordering', torch.tensor(ordering, dtype=torch.int64))
104+
self.register_buffer("ordering", torch.tensor(ordering, dtype=torch.int64))
105105
self.ordering_reversed: torch.Tensor
106-
self.register_buffer('ordering_reversed', torch.scatter(torch.zeros(self.sites, dtype=torch.int64), 0, self.ordering, torch.arange(self.sites, dtype=torch.int64)))
106+
self.register_buffer("ordering_reversed", torch.scatter(torch.zeros(self.sites, dtype=torch.int64), 0, self.ordering, torch.arange(self.sites, dtype=torch.int64)))
107107

108108
# Dummy Parameter for Device and Dtype Retrieval
109109
# This parameter is used to infer the device and dtype of the model.
@@ -348,9 +348,9 @@ def __init__( # pylint: disable=too-many-arguments
348348
if isinstance(ordering, int) and ordering == -1:
349349
ordering = list(reversed(range(self.sites)))
350350
self.ordering: torch.Tensor
351-
self.register_buffer('ordering', torch.tensor(ordering, dtype=torch.int64))
351+
self.register_buffer("ordering", torch.tensor(ordering, dtype=torch.int64))
352352
self.ordering_reversed: torch.Tensor
353-
self.register_buffer('ordering_reversed', torch.scatter(torch.zeros(self.sites, dtype=torch.int64), 0, self.ordering, torch.arange(self.sites, dtype=torch.int64)))
353+
self.register_buffer("ordering_reversed", torch.scatter(torch.zeros(self.sites, dtype=torch.int64), 0, self.ordering, torch.arange(self.sites, dtype=torch.int64)))
354354

355355
# Dummy Parameter for Device and Dtype Retrieval
356356
# This parameter is used to infer the device and dtype of the model.

0 commit comments

Comments
 (0)