pytorch 基础数学运算
# -*- coding:utf-8 -*-
# /usr/bin/python
'''
-------------------------------------------------
File Name : base_math
Description :
Envs :
Author : yanerrol
Date : 2019/12/23 22:50
-------------------------------------------------
Change Activity:
2019/12/23 22:50:
-------------------------------------------------
'''
__author__ = 'yanerrol'
import torch
a = torch.rand(3,4)
b = torch.rand(4)
# 每行对应的元素都增加
c = a+b
print('\na',a,'\nb',b,'\nc',c)
# 每行对应的元素相加
c = torch.add(a,b)
print(c)
c = a-b-(torch.sub(a,b))
print(c)
# 除
c = a/b-torch.div(a,b)
print(c)
# #
# # # a