Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tiendung committed Nov 29, 2022
1 parent 3c1afe2 commit 5c4d012
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions kim/nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def forward(self, X, h0=None):
hiddens = [init.zeros(bs, self.hidden_size, device=self.device) for _ in range(self.num_layers)]
else:
assert list(h0.shape) == [self.num_layers, bs, self.hidden_size]
hiddens = list(ops.split(h0, 0).detach())
hiddens = list(ops.split(h0, 0))

# Init outputs from X
outputs = [ Tensor(X.realize_cached_data()[i,:,:].reshape((bs, input_size)).compact(), device=self.device)
Expand All @@ -443,7 +443,6 @@ def forward(self, X, h0=None):
assert outputs[-1] == hiddens[-1]

return ops.stack(outputs, 0), ops.stack(hiddens, 0)
# Tham khảo https://pytorch.org/docs/stable/generated/torch.nn.RNN.html


class LSTMCell(Module):
Expand Down
8 changes: 4 additions & 4 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@

BACKEND_DEVICE=cuda python3 -m mugrade submit _r1VOvEAgPZvLXFJ18agr -k "resnet9"
python3 -m mugrade submit _r1VOvEAgPZvLXFJ18agr -k "rnn"
python3 -m pytest -k "test_rnn and relu and cuda"
python3 -m pytest -k "test_rnn[cuda-relu-False-False-12-11-1-1-13]"

python3 -m mugrade submit _r1VOvEAgPZvLXFJ18agr -k "lstm"
python3 -m pytest -k "lstm_cell and cpu-False-False-12-1-15"
python3 -m pytest -k "test_lstm[cuda-False-False-12-11-15-2-13]"
python3 -m pytest -k "lstm_cell and cuda-False-False-12-1-15"
python3 -m pytest -k "test_lstm"
python3 -m pytest -k "test_lstm[cuda-True-True-1-1-1-1-13]" # bị hang
python3 -m pytest -k "test_lstm[cuda-False-False-12-11-15-2-13]"
python3 -m pytest -k "test_lstm[cuda-True-True-1-1-1-1-13]"

python3 -m mugrade submit _r1VOvEAgPZvLXFJ18agr -k "ptb"
python3 -m pytest -l -v -k "ptb_dataset"
Expand Down

0 comments on commit 5c4d012

Please sign in to comment.