博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
tf.nn.softmax 分类
阅读量:4316 次
发布时间:2019-06-06

本文共 743 字,大约阅读时间需要 2 分钟。

tf.nn.softmax(logits,axis=None,name=None,dim=None)
参数:logits:一个非空的Tensor。必须是下列类型之一:half, float32,float64axis:将在其上执行维度softmax。默认值为-1,表示最后一个维度name:操作的名称(可选)dim:axis的已弃用的别名返回:一个Tensor,与logits具有相同的类型和shape

sample

import tensorflow as tf#tf.enable_eager_execution()tf.compat.v1.enable_eager_execution()ones = tf.ones(shape=[2,3])print(ones)temp1 = tf.nn.softmax(ones,axis=0) # 列print(temp1)temp2 = tf.nn.softmax(ones,axis=1) # 行print(temp2)

output

tf.Tensor([[1. 1. 1.] [1. 1. 1.]], shape=(2, 3), dtype=float32)tf.Tensor([[0.5 0.5 0.5] [0.5 0.5 0.5]], shape=(2, 3), dtype=float32)tf.Tensor([[0.33333334 0.33333334 0.33333334] [0.33333334 0.33333334 0.33333334]], shape=(2, 3), dtype=float32)

转载于:https://www.cnblogs.com/smallredness/p/11199447.html

你可能感兴趣的文章
Angular2,Springboot,Zuul,Shiro跨域CORS请求踩坑实录
查看>>
C语言中操作符的优先级大全
查看>>
SQL Server 查询分析器提供的所有快捷方式(快捷键)
查看>>
Linux - 查看系统基础信息的一般渠道
查看>>
Java第七次作业--图形用户界面
查看>>
MongoDB学习笔记06
查看>>
Powerdesigner+Execel
查看>>
数学基础 数论(二)
查看>>
走进模块
查看>>
什么是簇?
查看>>
[LeetCode] Construct Binary Tree from Inorder and Pretorder Traversal
查看>>
[转载]Android通过Socket上传文件
查看>>
golang 中的定时器(timer),更巧妙的处理timeout
查看>>
AT2134 Zigzag MST
查看>>
[NOI2019]回家路线
查看>>
何谓CRT,CRT的由来
查看>>
项目管理实践--VisualSVN Server
查看>>
2595 X之于Y 思维
查看>>
Selenium Webdriver模拟鼠标键盘操作
查看>>
java 导入其他包_java - 如何从默认包导入类
查看>>