关于MindSpore与Pytorch转换(官方文档未给出)
收藏回复举报
关于MindSpore与Pytorch转换(官方文档未给出)
t('forum.solved') 已解决
发表于2024-01-27 14:09:02
0 查看

在将pytorch转换成mindspore代码的时候,面对以下代码:

import torch.nn.functional as F 

from torch.distributions import Categorical

def sample_cycle_component(self, logits, output_type, random_ratio=0): 

        # 

        action_index_local = Categorical(logits=logits).sample() 

        prob_matrix = F.softmax(logits, dim=1) 

        log_prob_matrix = F.log_softmax(logits, dim=1) 

调用了pytorch.distributions的Categorical方法,但这部分并未在官网文档中给出(可能是未更新)

请问一下,这三行代码该怎么使用mindspore的方法进行呢?

我要发帖子