当前位置:网站首页>The softmax function is used in TF;
The softmax function is used in TF;
2022-08-11 07:51:00 【phac123】
简介
代码
import tensorflow as tf
x1 = tf.constant([[5.8, 4.0, 1.2, 0.2]]) # 5.8,4.0,1.2,0.2(0)
w1 = tf.constant([[-0.8, -0.34, -1.4],
[0.6, 1.3, 0.25],
[0.5, 1.45, 0.9],
[0.65, 0.7, -1.2]])
b1 = tf.constant([2.52, -3.1, 5.62])
y = tf.matmul(x1, w1) + b1
print("x1.shape:", x1.shape)
print("w1.shape:", w1.shape)
print("b1.shape:", b1.shape)
print("y.shape:", y.shape)
print("y:", y)
#####The following code will output the resultyConvert to probability value#####
y_dim = tf.squeeze(y) # 去掉y中纬度1(观察y_dim与 y 效果对比)
y_pro = tf.nn.softmax(y_dim) # 使y_dim符合概率分布,The output is a probability value
print("y_dim:", y_dim)
print("y_pro:", y_pro)
边栏推荐
- Go语言实现Etcd服务发现(Etcd & Service Discovery & Go)
- My creative anniversary丨Thank you for being with you for these 365 days, not forgetting the original intention, and each is wonderful
- 机器学习总结(二)
- 1002 Write the number (20 points)
- matplotlib
- 1091 N-自守数 (15 分)
- 接口测试的基础流程和用例设计方法你知道吗?
- 公牛10-11德里克·罗斯最强赛季记录
- 2022-08-10 mysql/stonedb-慢SQL-Q16-耗时追踪
- 1046 划拳 (15 分)
猜你喜欢
1.1-回归
Discourse 的关闭主题(Close Topic )和重新开放主题
关于Excel实现分组求和最全文档
About # SQL problem: how to set the following data by commas into multiple lines, in the form of column display
【软件测试】(北京)字节跳动科技有限公司二面笔试题
1091 N-Defensive Number (15 points)
1036 跟奥巴马一起编程 (15 分)
Redis source code: how to view the Redis source code, the order of viewing the Redis source code, the sequence of the source code from the external data structure of Redis to the internal data structu
DDR4内存条电路设计
1091 N-自守数 (15 分)
随机推荐
There may be fields that cannot be serialized in the abnormal object of cdc and sqlserver. Is there anyone who can understand it? Help me to answer
1096 大美数 (15 分)
Discourse's Close Topic and Reopen Topic
2022-08-10 mysql/stonedb-慢SQL-Q16-耗时追踪
1096 big beautiful numbers (15 points)
线程交替输出(你能想出几种方法)
JRS303-Data Verification
1076 Wifi密码 (15 分)
1101 How many times B is A (15 points)
机器学习总结(二)
Unity开发者必备的C#脚本技巧
How Unity programmers can improve their abilities
[Recommender System]: Overview of Collaborative Filtering and Content-Based Filtering
prometheus学习5altermanager
1056 组合数的和 (15 分)
Dynamic Agent Learning
1081 Check Password (15 points)
3.1-分类-概率生成模型
linux 安装mysql服务报错
1036 跟奥巴马一起编程 (15 分)