在将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的方法进行呢?
在将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的方法进行呢?