当前位置:网站首页>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)
边栏推荐
- Internet phone software or consolidation of attack must be "free" calls security clearance
- Activity的四种状态
- DDR4内存条电路设计
- CIKM 2022 AnalytiCup Competition: 联邦异质任务学习
- 为什么C#中对MySQL不支持中文查询
- 年薪40W测试工程师成长之路,你在哪个阶段?
- 1081 Check Password (15 points)
- 3.2 - classification - Logistic regression
- 1002 写出这个数 (20 分)
- 1076 Wifi Password (15 points)
猜你喜欢
随机推荐
1003 I want to pass (20 points)
3.1-分类-概率生成模型
1.2-误差来源
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
redis操作
Dynamic Agent Learning
tf中矩阵乘法
tf中自减操作;tf.assign_sub()
1071 小赌怡情 (15 分)
项目2-年收入判断
线程交替输出(你能想出几种方法)
1036 跟奥巴马一起编程 (15 分)
Strongly recommend an easy-to-use API interface
Pico neo3在Unity中的交互操作
easyrecovery15数据恢复软件收费吗?功能强大吗?
关于#sql#的问题:怎么将下面的数据按逗号分隔成多行,以列的形式展示出来
2022-08-10 mysql/stonedb-慢SQL-Q16-耗时追踪
Internet phone software or consolidation of attack must be "free" calls security clearance
【Pytorch】nn.ReLU(inplace=True)
【LeetCode每日一题】——844.比较含退格的字符串








