From 629f5758103b2477a64e9b8202e069f2cb6862bf Mon Sep 17 00:00:00 2001 From: lucascolas Date: Mon, 4 Sep 2023 17:45:33 -0400 Subject: [PATCH] check if a tensor if empty --- PokerPlus/DeepCFR/nn.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PokerPlus/DeepCFR/nn.py b/PokerPlus/DeepCFR/nn.py index ded11ec..70f1a8a 100644 --- a/PokerPlus/DeepCFR/nn.py +++ b/PokerPlus/DeepCFR/nn.py @@ -62,7 +62,8 @@ def forward(self, cards, bets): for embedding, card_group in zip(self.card_embeddings, cards): print("do embedding") print("card_group: ", card_group) - card_embs.append(embedding(card_group.view(1, -1))) + if card_group.numel(): + card_embs.append(embedding(card_group.view(1, -1))) card_embs = torch.cat(card_embs, dim=1) x = F.relu(self.card1(card_embs)) x = F.relu(self.card2(x))