当前位置:网站首页>tf.cast(), reduce_min(), reduce_max()

tf.cast(), reduce_min(), reduce_max()

2022-08-11 07:47:00 phac123

Article table of contents

Introduction

In tensorflow, you can use tf.cast() to convert the type of tensor variables. Use tf.reduce_min and tf.reduce_max to calculate the maximum and minimum values ​​of elements on the tensor.

implemented

import tensorflow as tfx1 = 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))

insert image description here

原网站

版权声明
本文为[phac123]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/223/202208110645028277.html