当前位置:网站首页>tf.cast(),reduce_min(),reduce_max()
tf.cast(),reduce_min(),reduce_max()
2022-08-11 06:45:00 【phac123】
简介
在tensorflow中可以使用tf.cast()对tensor变量的类型进行转换.使用tf.reduce_min和tf.reduce_max可以计算张量上元素的最大值和最小值.
实现
import tensorflow as tf
x1 = tf.constant([1., 2., 3.], dtype = tf.float64)
print("x1: ", x1)
x2 = tf.cast(x1, tf.int32)
print("x2: ", x2)
print("minimum of x2: ", tf.reduce_min(x2))
print("maxmum of x2: ", tf.reduce_max(x2))
边栏推荐
猜你喜欢
随机推荐
【Pytorch】nn.PixelShuffle
STM32CUBEIDE(11)----输出PWM及修改PWM频率与占空比
EasyPlayer针对H.265视频不自动播放设置下,loading状态无法消失的解决办法
concept noun
Daily sql-employee bonus filtering and answer rate ranking first
CIKM 2022 AnalytiCup Competition: 联邦异质任务学习
3GPP LTE/NR信道模型
NTT的Another Me技术助力创造歌舞伎演员中村狮童的数字孪生体,将在 “Cho Kabuki 2022 Powered by NTT”舞台剧中首次亮相
js判断图片是否存在
JVM学习——3——数据一致性
为什么我使用C#操作MySQL进行中文查询失败
Strongly recommend an easy-to-use API interface
MindManager2022全新正式免费思维导图更新
Unity开发者必备的C#脚本技巧
ROS 服务通信理论模型
Douyin share password url API tool
【软件测试】(北京)字节跳动科技有限公司二面笔试题
Pinduoduo api interface application example
【推荐系统】:协同过滤和基于内容过滤概述
C语言每日一练——Day02:求最小公倍数(3种方法)