pytorch 三角函数

import torch
import numpy as np
import math
data = [-0.9999,-0.5, -0.1, 0.8,0.9]
tensor = torch.FloatTensor(data)  # 转换成32位浮点 tensor

# sin   三角函数 sin
print(
    '\nsin',torch.log(math.pi- torch.asin(tensor)),
    '\nnumpy: ', math.pi- np.arcsin(data),      # [-0.84147098 -0.90929743  0.84147098  0.90929743]
    '\ntorch: ', torch.sin( math.pi- torch.asin(tensor))  # [-0.8415 -0.9093  0.8415  0.9093]
)
发布了2614 篇原创文章 · 获赞 926 · 访问量 509万+

猜你喜欢

转载自blog.csdn.net/jacke121/article/details/104037213
今日推荐