Python API Guides (仅记录日常用到的api)
Python API Guides
-
Tensor转换: Ref
-
生成tensor
- tf.string_to_number
- tf.to_double
- tf.to_float
- tf.to_bfloat16
- tf.to_int32
- tf.to_int64
- tf.cast
-
tensor形状op
- tf.shape
- tf.size
- tf.rank
- tf.reshape
- tf.squeeze
- tf.expand_dims
-
切片和插入op
- tf.slice
- tf.split
- tf.pad
- tf.concat
- tf.transpose
-
-
断言和布尔检查: Ref
Defined in tensorflow/python/ops/check_ops.py
-
Graphs运作: Ref
-
会话管理
-
Defined in tensorflow/python/client/session.py
-
Defined in tensorflow/python/client/session.py.
-
Defined in tensorflow/python/framework/ops.py.
-
-
错误类和方便功能
-
tf.OpError
Defined in tensorflow/python/framework/errors_impl.py.
-
-
-
常量、序列和随机变量: Ref
-
生成常量tensor
- tf.zeros
- tf.zeros_like
- tf.ones
- tf.ones_like
- tf.fill
- tf.constant
-
生成序列op
- tf.linspace
- tf.range
-
生成随机tensor
Under Tensorflow/python/ops dir or Tnesorflow/python/framework dir
- tf.random_normal
- tf.truncated_normal
- tf.random_uniform
- tf.random_shuffle
-
-
构建网络层: Ref
-
高级构建op
- tf.contrib.layers.avg_pool2d
- tf.contrib.layers.batch_norm
- tf.contrib.layers.convolution2d
- tf.nn.conv2d_transpose
- tf.contrib.layers.convolution2d_transpose
- tf.nn.dropout
- tf.contrib.layers.fully_connected
- tf.contrib.layers.max_pool2d
- tf.nn.relu
- tf.nn.relu6
- tf.nn.softmax
- tf.stack
- tf.contrib.layers.unit_norm
-
正则化op
Defined in tensorflow/contrib/layers/python/layers/regularizers.py.
- tf.contrib.layers.l1_regularizer
- tf.contrib.layers.l2_regularizer
-
初始化op
Defined in tensorflow/contrib/layers/python/layers/initializers.py
-
(权重)优化op
Defined in tensorflow/contrib/layers/python/layers/optimizers.py
-
总结op
Defined in tensorflow/contrib/layers/python/layers/summaries.py
- tf.contrib.layers.summarize_activation
- tf.contrib.layers.summarize_tensor
- tf.contrib.layers.summarize_tensors
- tf.contrib.layers.summarize_collection
- tf.contrib.layers.summarize_activations
-
-
RNN: Ref
-
过程控制: Ref
-
过程控制op:
- tf.identity
- tf.tuple
-
逻辑op:
- tf.logical_and
- tf.logical_not
- tf.logical_or
- tf.logical_xor
-
对照op:
- tf.equal
- tf.not_equal
- tf.less
- tf.less_equal
- tf.greater
- tf.greater_equal
- tf.where
-
调试op:
-
tf.is_finite
Defined in tensorflow/python/ops/gen_math_ops.py
-
tf.Assert
Defined in tensorflow/python/ops/control_flow_ops.py.
-
tf.Print
Defined in tensorflow/python/ops/logging_ops.py.
-
-
-
构建graph: Ref
-
核心graph数据结构op
Defined in tensorflow/python/framework/ops.py
- tf.Graph
- tf.Operation
- tf.Tensor
-
tensor类型op
Defined in tensorflow/python/framework/dtypes.py
- tf.DType
- tf.as_dtype
-
Utility函数op
Defined in tensorflow/python/framework/ops.py
- tf.device
- tf.container
- tf.name_scope
- tf.get_default_graph
- tf.reset_default_graph
-
自定义op
-
class tf.TensorShape
Defined in tensorflow/python/framework/tensor_shape.py.
-
-
-
图像: Ref
-
图像调整op
- tf.image.resize_images
-
-
输入和读取:
-
占位符op
- tf.placeholder
- tf.placeholder_with_default
-
读取op
- tf.ReaderBase
- tf.IdentityReader
- tf.TFRecordReader
-
转换成tensor
- tf.decode_csv
- tf.decode_raw
-
队列op
- tf.QueueBase
- tf.FIFOQueue
-
文件处理op
- tf.matching_files
- tf.read_file
- tf.write_file
-
流水线输入op
- tf.train.batch
- tf.train.maybe_batch
- tf.train.batch_join
- tf.train.maybe_batch_join
- tf.train.shuffle_batch
-
-
数学计算: {Detail}
Defined in tensorflow/python/ops/math_ops.py
-
算数op
- tf.add
- tf.subtract
- tf.multiply
- tf.scalar_mul
- tf.div
- tf.divide
- tf.truediv
- tf.floordiv
- tf.realdiv
- tf.truncatediv
- tf.floor_div
- tf.truncatemod
- tf.floormod
- tf.mod
- tf.cross
-
基本数学op
- tf.add_n
- tf.abs
- tf.negative
- tf.sign
- tf.square
- tf.round
- tf.sqrt
- tf.exp
- tf.expm1
- tf.log
- tf.log1p
- tf.ceil
- tf.floor
- tf.maximum
- tf.minimum
- tf.cos
- tf.sin
- tf.tan
- tf.acos
- tf.asin
- tf.atan
-
矩阵的线代op
- tf.diag
- tf.trace
- tf.transpose
- tf.eye
- tf.matrix_diag
- tf.matrix_transpose
- tf.matmul
- tf.norm
- tf.cholesky
-
复数op
- tf.complex
- tf.conj
- tf.imag
- tf.real
-
降维op
- tf.reduce_sum
- tf.reduce_prod
- tf.reduce_min
- tf.reduce_max
- tf.reduce_mean
- tf.reduce_all
- tf.reduce_any
-
切片op
- tf.segment_sum
- tf.segment_prod
- tf.segment_min
- tf.segment_max
- tf.segment_mean
- tf.sparse_segment_sum
- tf.sparse_segment_mean
-
序列比较和索引提取op
- tf.argmin
- tf.argmax
- tf.where
- tf.unique
-
-
神经网络
-
激活op
- tf.nn.relu
- tf.nn.relu6
- tf.nn.crelu
- tf.nn.elu
- tf.nn.softplus
- tf.nn.softsign
- tf.nn.dropout
- tf.nn.bias_add
- tf.sigmoid
- tf.tanh
-
卷积op
- tf.nn.convolution
- tf.nn.conv2d
- tf.nn.depthwise_conv2d
- tf.nn.depthwise_conv2d_native
- tf.nn.separable_conv2d
- tf.nn.atrous_conv2d
- tf.nn.atrous_conv2d_transpose
- tf.nn.conv2d_transpose
- tf.nn.conv1d
- tf.nn.conv3d
- tf.nn.conv3d_transpose
- tf.nn.conv2d_backprop_filter
- tf.nn.conv2d_backprop_input
- tf.nn.conv3d_backprop_filter_v2
- tf.nn.depthwise_conv2d_native_backprop_filter
- tf.nn.depthwise_conv2d_native_backprop_input
-
池化op
- tf.nn.avg_pool
- tf.nn.max_pool
- tf.nn.max_pool_with_argmax
- tf.nn.avg_pool3d
- tf.nn.max_pool3d
- tf.nn.fractional_avg_pool
- tf.nn.fractional_max_pool
- tf.nn.pool
-
归一化op
- tf.nn.l2_normalize
- tf.nn.local_response_normalization
- tf.nn.sufficient_statistics
- tf.nn.normalize_moments
- tf.nn.moments
- tf.nn.weighted_moments
- tf.nn.fused_batch_norm
- tf.nn.batch_normalization
- tf.nn.batch_norm_with_global_normalization
-
误差损失op
- tf.nn.l2_loss
- tf.nn.log_poisson_loss
-
分类op
- tf.nn.sigmoid_cross_entropy_with_logits
- tf.nn.softmax
- tf.nn.log_softmax
- tf.nn.softmax_cross_entropy_with_logits
- tf.nn.sparse_softmax_cross_entropy_with_logits
- tf.nn.weighted_cross_entropy_with_logits
-
查找嵌入tensor的value
- tf.nn.embedding_lookup
- tf.nn.embedding_lookup_sparse
-
候选抽样op
- tf.nn.sampled_softmax_loss
-
-
value
-
value
- tf.Variable
-
value管理op
- tf.global_variables
- tf.local_variables
- tf.model_variables
- tf.trainable_variables
- tf.moving_average_variables
- tf.global_variables_initializer
- tf.local_variables_initializer
- tf.variables_initializer
- tf.is_variable_initialized
- tf.report_uninitialized_variables
- tf.assert_variables_initialized
- tf.assign
- tf.assign_add
- tf.assign_sub
-
value保存和恢复op
- tf.train.Saver
- tf.train.latest_checkpoint
- tf.train.get_checkpoint_state
- tf.train.update_checkpoint_state
-
value共享op
- tf.get_variable
- tf.get_local_variable
- tf.VariableScope
- tf.variable_scope
- tf.variable_op_scope
- tf.get_variable_scope
- tf.constant_initializer
- tf.random_normal_initializer
- tf.truncated_normal_initializer
- tf.random_uniform_initializer
- tf.uniform_unit_scaling_initializer
- tf.zeros_initializer
- tf.ones_initializer
-