xiaoqing-ing

一、点积

概念:相同位置的按元素乘积的和,可以通过dot()函数调用

y = torch.ones(4, dtype=torch.float32)
print(y)
print(x)

# 点积:相同位置的按元素乘积的和
print(torch.dot(x, y))

# 可以通过执行元素乘法,然后进行求和来表示两个向量的点积
print(x*y)
print((x*y).sum())

#输出结果

tensor([1., 1., 1., 1.])
tensor([0., 1., 2., 3.])
tensor(6.)
tensor([0., 1., 2., 3.])
tensor(6.)

  

二、矩阵-向量积

1、调用mv函数求矩阵向量积

2、矩阵向量积 

分类:

技术点:

相关文章:

  • 2021-12-19
  • 2022-02-04
  • 2021-12-05
  • 2021-11-20
  • 2021-12-03
  • 2021-12-20
  • 2021-11-17
猜你喜欢
  • 2021-04-25
  • 2022-02-10
  • 2021-10-29
  • 2021-10-09
  • 2021-09-08
  • 2021-12-05
  • 2021-12-10
相关资源
相似解决方案