-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: apply black --line-length=120;
- Loading branch information
Showing
163 changed files
with
683 additions
and
2,098 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
and takes over the forward progress of the algorithm. | ||
""" | ||
|
||
|
||
# Created by Wenjie Du <[email protected]> | ||
# License: BSD-3-Clause | ||
|
||
|
@@ -84,21 +83,13 @@ def forward(self, inputs, training=True): | |
lengths2 = lengths.unsqueeze(1).to(device) | ||
mask2 = mask.permute(1, 0).unsqueeze(2).long() | ||
if self.sensor_wise_mask: | ||
output = torch.zeros( | ||
[batch_size, self.n_features, self.d_ob + 16], device=device | ||
) | ||
output = torch.zeros([batch_size, self.n_features, self.d_ob + 16], device=device) | ||
extended_missing_mask = missing_mask.view(-1, batch_size, self.n_features) | ||
for se in range(self.n_features): | ||
representation = representation.view( | ||
-1, batch_size, self.n_features, (self.d_ob + 16) | ||
) | ||
representation = representation.view(-1, batch_size, self.n_features, (self.d_ob + 16)) | ||
out = representation[:, :, se, :] | ||
l_ = torch.sum(extended_missing_mask[:, :, se], dim=0).unsqueeze( | ||
1 | ||
) # length | ||
out_sensor = torch.sum( | ||
out * (1 - extended_missing_mask[:, :, se].unsqueeze(-1)), dim=0 | ||
) / (l_ + 1) | ||
l_ = torch.sum(extended_missing_mask[:, :, se], dim=0).unsqueeze(1) # length | ||
out_sensor = torch.sum(out * (1 - extended_missing_mask[:, :, se].unsqueeze(-1)), dim=0) / (l_ + 1) | ||
output[:, se, :] = out_sensor | ||
output = output.view([-1, self.n_features * (self.d_ob + 16)]) | ||
elif self.aggregation == "mean": | ||
|
@@ -116,9 +107,7 @@ def forward(self, inputs, training=True): | |
|
||
# if in training mode, return results with losses | ||
if training: | ||
classification_loss = F.nll_loss( | ||
torch.log(classification_pred), inputs["label"] | ||
) | ||
classification_loss = F.nll_loss(torch.log(classification_pred), inputs["label"]) | ||
results["loss"] = classification_loss | ||
|
||
return results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
""" | ||
|
||
|
||
# Created by Wenjie Du <[email protected]> | ||
# License: BSD-3-Clause | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.