tf.constant
(value, dtype=None, shape=None, name="Const", verify_shape=False):
创建一个常数张量
value: 常数值,或list
dtype: 结果张量中元素的类型
shape: 结果张量的形状
name: 张量名称
verify_shape: 可验证值形状的布尔值
tf.assign_add
(ref, value, use_locking=None, name=None):
向ref中累加值并将其更新
ref: 规定类型的可变的张量(float32, float64, int8, int16, int32, int64, uint8, uint16, complex64, complex128, qint8, qint32, quint8, half)
value: 累加值,类型与ref相同
use_locking:是否添加锁保护,默认为False(可选参数)
name: 操作名称(可选参数)
tf.global_variables_initializer():
返回初始化全局变量的操作(ops),通过tf.Session.run(ops)在会话中运行操作并计算张量
tf.read_file
(filename, name=None):
读取并输出filename(张量)的内容
filename: 字符串类型的张量
name:操作的名称
tf.parse_single_example
(serialized, features, name=None, example_names=None)
解释单一“协议内存块”
serialized: 一个标量的字符串张量,一个序列化的内存块
features: 解释的内容映射到该dict(字典)中
tf.FixedLenFeatures
(shape, dtype, default_value)
解析固定长度的输入特征
shape: 输入数据的形状
dtype: 输入数据的类型
default_value: 如果示例缺少此特性,则使用的值。它必须与“dtype”和指定的“shape”兼容。
tf.parse_single_example
(serialized, features, name=None, example_names=None)
解释单一的example协议内存块
serialized: tf.TFRecordReader()对象读入的字符串张量
features: 字典 -> 映射为tf.FiexdLenFeature或tf.VarLenFeature的值
tf.decode_raw
(bytes, out_type, little_endian=True, name=None)
将string字节重新解释为数字vector(数字向量)
bytes: string类型的张量(内部所有元素必须等长)
out_type: 输出类型(tf内置数据类型)
tf.cast
(x, dtype, name=None)
将一个张量转换为新类型
x:数字类型的张量或稀疏张量
dtype: 目标类型