当前位置:网站首页>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)
边栏推荐
- How Unity handles C# under the hood
- easyrecovery15数据恢复软件收费吗?功能强大吗?
- js根据当天获取前几天的日期
- Production and optimization of Unity game leaderboards
- Four operations in TF
- golang fork 进程的三种方式
- 1.1-回归
- 关于Excel实现分组求和最全文档
- When MySQL uses GROUP BY to group the query, the SELECT query field contains non-grouping fields
- Evolution and New Choice of Streaming Structured Data Computing Language
猜你喜欢
1096 大美数 (15 分)
TF中的四则运算
Item 2 - Annual Income Judgment
接口测试的基础流程和用例设计方法你知道吗?
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
查找最新人员工资和上上次人员工资的变动情况
1003 I want to pass (20 points)
伦敦银规则有哪些?
1081 Check Password (15 points)
Four operations in TF
随机推荐
【LeetCode每日一题】——844.比较含退格的字符串
关于Android Service服务的面试题
tf中自减操作;tf.assign_sub()
【软件测试】(北京)字节跳动科技有限公司终面HR面试题
1076 Wifi密码 (15 分)
Four operations in TF
语音信号处理:预处理【预加重、分帧、加窗】
梅科尔工作室——BP神经网络
LeetCode刷题系列 -- 46. 全排列
基于FPGA的FIR滤波器的实现(5)— 并行结构FIR滤波器的FPGA代码实现
break pad源码编译--参考大佬博客的总结
机器学习总结(二)
1081 检查密码 (15 分)
1061 True or False (15 points)
数仓开发知识总结
动态代理学习
Discourse's Close Topic and Reopen Topic
4.1 - Support Vector Machines
Activity的四种启动模式
tf.cast(), reduce_min(), reduce_max()