fix import and some error
This commit is contained in:
@@ -6,7 +6,8 @@ from torch.optim import SGD
|
||||
|
||||
from tugo.agents.base import Agent
|
||||
from tugo.agents.helpers import is_point_an_eye
|
||||
from game_logic import goboard
|
||||
# from tugo.game_logic import goboard
|
||||
from tugo.game_logic import goboard_fast as goboard
|
||||
|
||||
|
||||
def policy_gradient_loss(y_true, y_pred):
|
||||
@@ -26,7 +27,8 @@ class PolicyAgent(Agent):
|
||||
|
||||
def predict(self, game_state):
|
||||
encoded_state = self._encoder.encode(game_state)
|
||||
input_tensor = torch.tensor([encoded_state], dtype=torch.float32).to('cuda')
|
||||
# input_tensor = torch.tensor([encoded_state], dtype=torch.float32).to('cuda')
|
||||
input_tensor = encoded_state.float().to('cuda')
|
||||
with torch.no_grad():
|
||||
output_tensor = self._model(input_tensor)
|
||||
return output_tensor.cpu().numpy()[0]
|
||||
|
||||
Reference in New Issue
Block a user