Create python code to matlab ?
이전 댓글 표시
Hi, I have code Python like below :
probs = exp_scores / np.sum(exp_scores, axis=1, keepdims=True)
Then, I write to matlab code
probs = exp_scores/sum(exp_scores);
My question is, my code above is correct in matlab ? Thanks
댓글 수: 3
Surely you can just look at the result and compare it to the python result. It depends what exp_scores is. If it is non-scalar then you would likely need to use
./
Oman Wisni
2018년 11월 16일
Adam
2018년 11월 16일
axis = 1
in python means sum along dimension 1, but python indexes from 0 whereas Matlab indexes from 1 so I would think that you need
sum( exp_scores, 2 )
in Matlab.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!