当前位置:网站首页>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))
边栏推荐
猜你喜欢
随机推荐
buu—Re(5)
关于Android Service服务的面试题
计算YUV文件的PSNR与SSIM
国密规范 SM2 SM3 SM4
STM32CUBEIDE(11)----输出PWM及修改PWM频率与占空比
Unity3D learning route?
Edge 提供了标签分组功能
Amazon Get AMAZON Product Details API Return Value Description
Cobbleland 博览会 基础系列 1
go-grpc TSL认证 解决 transport: authentication handshake failed: x509 certificate relies on ... ...
2022-08-10 Group 4 Self-cultivation class study notes (every day)
concept noun
Service的两种启动方式与区别
Douyin API interface
囍楽云任务源码
Douyin API interface
Implementation of FIR filter based on FPGA (5) - FPGA code implementation of parallel structure FIR filter
EasyPlayer针对H.265视频不自动播放设置下,loading状态无法消失的解决办法
李沐d2l(十)--卷积层Ⅰ
【latex异常和错误】Missing $ inserted.<inserted text>You can‘t use \spacefactor in math mode.输出文本要注意特殊字符的转义