Skip to content

Commit 3c92a5e

Browse files
committed
fix TensorPy init empty Tensor
1 parent f91a51b commit 3c92a5e

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

mindnlp/core/ops/creation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def empty(*size, dtype=None):
123123
size = size[0]
124124
if dtype is None:
125125
dtype = get_default_dtype()
126-
out = CTensor(dtype, size)
126+
out = CTensor(dtype=dtype, shape=size)
127127
return mindspore.Tensor(out)
128128

129129
# empty_like

mindnlp/transformers/models/rag/modeling_rag.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,8 +1064,7 @@ def marginalize(self, seq_logits, doc_scores, n_docs=None):
10641064
)
10651065
doc_logprobs = F.log_softmax(doc_scores, dim=1)
10661066
log_prob_sum = seq_logprobs + doc_logprobs.unsqueeze(-1).unsqueeze(-1)
1067-
# return ops.logsumexp(log_prob_sum, dim=1)
1068-
return mindspore.ops.logsumexp(log_prob_sum, axis=1)
1067+
return ops.logsumexp(log_prob_sum, dim=1)
10691068

10701069
def forward(
10711070
self,

0 commit comments

Comments
 (0)