Skip to content

Commit

Permalink
fix TensorPy init empty Tensor (#1962)
Browse files Browse the repository at this point in the history
  • Loading branch information
lvyufeng authored Feb 19, 2025
1 parent d859a1b commit 3ea3f4a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mindnlp/core/ops/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def empty(*size, dtype=None):
size = size[0]
if dtype is None:
dtype = get_default_dtype()
out = CTensor(dtype, size)
out = CTensor(dtype=dtype, shape=size)
return mindspore.Tensor(out)

# empty_like
Expand Down
3 changes: 1 addition & 2 deletions mindnlp/transformers/models/rag/modeling_rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,8 +1064,7 @@ def marginalize(self, seq_logits, doc_scores, n_docs=None):
)
doc_logprobs = F.log_softmax(doc_scores, dim=1)
log_prob_sum = seq_logprobs + doc_logprobs.unsqueeze(-1).unsqueeze(-1)
# return ops.logsumexp(log_prob_sum, dim=1)
return mindspore.ops.logsumexp(log_prob_sum, axis=1)
return ops.logsumexp(log_prob_sum, dim=1)

def forward(
self,
Expand Down

0 comments on commit 3ea3f4a

Please sign in to comment.