forked from VSharp-team/VSharp
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove best_models_dict saving. Add directory for teachers. Remove su…
…pport dict as model's output. Add function for last layer adding
- Loading branch information
Showing
11 changed files
with
250 additions
and
256 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 was deleted.
Oops, something went wrong.
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
40 changes: 40 additions & 0 deletions
40
VSharp.ML.AIAgent/ml/models/TAGSageSimple/model_modified.py
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import torch | ||
from torch.nn import Linear | ||
from torch_geometric.nn import Linear | ||
|
||
from learning.timer.wrapper import timeit | ||
from torch.nn.functional import softmax | ||
from .model import StateModelEncoder | ||
|
||
|
||
class StateModelEncoderLastLayer(StateModelEncoder): | ||
def __init__(self, hidden_channels, out_channels): | ||
super().__init__(hidden_channels, out_channels) | ||
self.lin_last = Linear(out_channels, 1) | ||
|
||
def forward( | ||
self, | ||
game_x, | ||
state_x, | ||
edge_index_v_v, | ||
edge_type_v_v, | ||
edge_index_history_v_s, | ||
edge_attr_history_v_s, | ||
edge_index_in_v_s, | ||
edge_index_s_s, | ||
): | ||
return softmax( | ||
self.lin_last( | ||
super().forward( | ||
game_x=game_x, | ||
state_x=state_x, | ||
edge_index_v_v=edge_index_v_v, | ||
edge_type_v_v=edge_type_v_v, | ||
edge_index_history_v_s=edge_index_history_v_s, | ||
edge_attr_history_v_s=edge_attr_history_v_s, | ||
edge_index_in_v_s=edge_index_in_v_s, | ||
edge_index_s_s=edge_index_s_s, | ||
) | ||
), | ||
dim=0, | ||
) |
Oops, something went wrong.