We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
def forward(enc_inputs, dec_inputs): """前向网络 enc_inputs: [batch_size, src_len] dec_inputs: [batch_size, trg_len] """ logits, _, _, _ = model(enc_inputs, dec_inputs[:, :-1], src_pad_idx, trg_pad_idx)
targets = dec_inputs[:, 1:].view(-1) loss = loss_fn(logits, targets) return loss
The text was updated successfully, but these errors were encountered:
logit数组 【batch_size, *src_len, trg_vocab_size】 targets数组【batch_size, *src_len】 两个数组维数不一致,而且对这两个数组使用loss_fn 没有实际意义
Sorry, something went wrong.
No branches or pull requests
def forward(enc_inputs, dec_inputs):
"""前向网络
enc_inputs: [batch_size, src_len]
dec_inputs: [batch_size, trg_len]
"""
logits, _, _, _ = model(enc_inputs, dec_inputs[:, :-1], src_pad_idx, trg_pad_idx)
The text was updated successfully, but these errors were encountered: