TensorFlow2.0矩阵与向量的加减乘
2024-09-04 23:27:45
1、矩阵加法使用
a = np.random.random((3,3))
b = np.random.randint(0,9,(3,3))
ad = tf.add(a,b)
2、矩阵乘法注意
# tensorflow 使用矩阵乘法都必须使用相同类型的数据,否则报错。
a = np.random.random((5,3))
b = np.random.randint(0,9,(3,6))
c = tf.tensordot(a.astype(np.float),b.astype(np.float),axes=1)
print(c.numpy())
3、矩阵减法
a = np.random.random((3,3))
b = np.random.randint(0,9,(3,3))
ad = tf.subtract(a,b)
4、数的除法
d = tf.divide(9*2,3)
print(d.numpy())
最新文章
- SQL-类型转换函数
- [ES] 安装
- 插入排序-java
- Java数据结构的特点
- Dubbo入门实例--转载
- Asp.net 导入Excel数据
- bootstrap--组件之按钮式下拉菜单
- Automator 简单使用流程
- C++图形编程之graphics.h头文件
- shiro授权
- redux+saga+reducer
- Git服务器Gogs简易安装-Windows环境
- Git基本操作指令
- 最全面的 Spring 学习笔记
- 【转】C++ 11 并发指南一(C++ 11 多线程初探)
- HDU6095
- ArcGIS Server Rest 认证过程分析
- python - how to sort
- 解决debug到jdk源码时不能查看变量值的问题
- WPF基础学习笔记整理 (七) Binding绑定