当前位置:网站首页>TF使用constant生成数据
TF使用constant生成数据
2022-08-09 21:35:00 【phac123】
简介
TF指定了生成的数据类型,最后生成的数据就是指定的类型;如果TF中使用constant没有指定生成什么数据,如果是1,4这样的整数,那么默认的数据类型为 tf.int32.
实现与分析
One
import tensorflow as tf
a = tf.constant([1, 5], dtype = tf.int64)
print("a: ", a)
print("a.dtype: ", a.dtype)
print("a.shape: ", a.shape)

Two:默认
import tensorflow as tf
a = tf.constant([1, 5])
print("a: ", a)
print("a.dtype: ", a.dtype)
print("a.shape: ", a.shape)

three
import tensorflow as tf
a = tf.constant([1, 5], dtype = tf.float32)
print("a: ", a)
print("a.dtype: ", a.dtype)
print("a.shape: ", a.shape)

边栏推荐
猜你喜欢
随机推荐
抽象类 or 接口
【云原生】4.2 DevOps 精讲篇
Problems with compiling SIP with QGIS
Optimization of SQL Statements and Indexes
字符串哈希(2014 SERC J题)
C语言之实现倒置字符串的两种方法
Unity2D_线框材质
访问控制知识
Week 8 Deep learning for object detection
Jmeter 使用正则表达式提取器将返回值全部保存到一个文件中
Access Characteristics of Constructor under Inheritance Relationship
数据集成API如何成为企业数字化转型的关键?
编程语言中,取余和取模的区别
MySQL:错误1153(08S01):得到的数据包大于“ max_allowed_packet”字节
字节二面问的MySQL,差点没答好
Ali Ermi: Without accept, can a TCP connection be established?
蓝牙模块有哪些种类?BLE低功耗蓝牙模块有什么特点?
json事例
CMake installation upgrade higher version
DSPE-PEG-Azide, DSPE-PEG-N3, phospholipid-polyethylene glycol-azide can react directly with DBCO









