6 API DOC —— Python API

Posted BreakofDawn

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了6 API DOC —— Python API相关的知识,希望对你有一定的参考价值。

 切记:tensorflow中大小写非常有区别!!

3.2. 变量:创建、初始化、保存和加载:

tf.Variable

6.3.1 ARRAY OPS

tf.reshape(tensor, shape, name=None)

6.3.2. CLIENT

class tf.Session

tf.Session.run(fetches, feed_dict=None)

6.3.3. CONSTANT OP:

tf.random_uniform(shape, minval=0.0, maxval=1.0, dtype=tf.float32, seed=None, name=None)

tf.random_normal(shape, mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=None)

tf.zeros(shape, dtype=tf.float32, name=None)

tf.constant(value, dtype=None, shape=None, name=\'Const\')

6.3.5 FRAMWORK

tf.name_scope(name)

6.3.8. IO OPS

tf.placeholder(dtype, shape=None, name=None)

6.3.9:Math Opt:

tf.reduce_mean

tf.square(x, name=None)

tf.matmul(a, b, transpose_a=False, transpose_b=False, a_is_sparse=False, b_is_sparse=False, name=None)

tf.add(x, y, name=None)

tf.reduce_sum(input_tensor, reduction_indices=None, keep_dims=False, name=None)

6.3.10. NN

Activation Functions

tf.nn.relu(features, name=None) 

tf.nn.dropout(x, keep_prob, noise_shape=None, seed=None, name=None)

Convolution

tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None, name=None)

Pooling

tf.nn.max_pool(value, ksize, strides, padding, name=None)

6.3.13. STATE OPS

tf.initialize_all_variables()

tf.random_normal_initializer(mean=0.0, stddev=1.0, seed=None)

tf.constant_initializer(value=0.0)

tf.train.get_checkpoint_state(checkpoint_dir, latest_filename=None)

6.3.14. TRAIN

class tf.train.GradientDescentOptimizer(learning_rate=?)



Google:

tf.summary.histogram

 





 

3.2. 变量:创建、初始化、保存和加载:

class tf.Variable

http://www.tensorfly.cn/tfdoc/api_docs/python/array_ops.html#reshape

6.3.1 ARRAY OPS

tf.reshape(tensor, shape, name=None)

https://blog.csdn.net/lxg0807/article/details/53021859

http://www.tensorfly.cn/tfdoc/api_docs/python/array_ops.html#reshape

6.3.2. CLIENT

class tf.Session

tf.Session.run(fetches, feed_dict=None):

http://www.tensorfly.cn/tfdoc/api_docs/python/client.html#Session

6.3.3. CONSTANT OP:

tf.random_uniform(shape, minval=0.0, maxval=1.0, dtype=tf.float32, seed=None, name=None):

Outputs random values from a uniform distribution.(从均匀分布中输出随机值)

The generated values follow a uniform distribution in the range [minval, maxval). The lower bound minval is included in the range, while the upper bound maxval is excluded.

http://www.tensorfly.cn/tfdoc/api_docs/python/constant_op.html#random_uniform

tf.random_normal(shape, mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=None)

  • mean: A 0-D Tensor or Python value of type dtype. The mean of the normal distribution(正态分布的均值)
  • stddev: A 0-D Tensor or Python value of type dtype. The standard deviation of the normal distribution(正态分布的标准差).

http://www.tensorfly.cn/tfdoc/api_docs/python/constant_op.html#random_normal

tf.zeros(shape, dtype=tf.float32, name=None)

http://www.tensorfly.cn/tfdoc/api_docs/python/constant_op.html#zeros 

tf.constant(value, dtype=None, shape=None, name=\'Const\')

 

注意:上面tf.constant()中参数指出shape的必要性,参数对应!

 参考链接:http://www.tensorfly.cn/tfdoc/api_docs/python/constant_op.html#constant

6.3.5 FRAMWORK

tf.name_scope(name)

http://www.tensorfly.cn/tfdoc/api_docs/python/framework.html#name_scope

6.3.8. IO OPS

tf.placeholder(dtype, shape=None, name=None)

Inserts a placeholder for a tensor that will be always fed.

参考链接:http://www.tensorfly.cn/tfdoc/api_docs/python/io_ops.html#placeholder

6.3.9:Math Opt:

tf.reduce_mean(input_tensor, reduction_indices=None, keep_dims=False, name=None):

http://www.tensorfly.cn/tfdoc/api_docs/python/math_ops.html#reduce_mean 

tf.square(x, name=None)

http://www.tensorfly.cn/tfdoc/api_docs/python/math_ops.html#square

tf.matmul(a, b, transpose_a=False, transpose_b=False, a_is_sparse=False, b_is_sparse=False, name=None)

http://www.tensorfly.cn/tfdoc/api_docs/python/math_ops.html#matmul

tf.add(x, y, name=None)

http://www.tensorfly.cn/tfdoc/api_docs/python/math_ops.html#add

tf.reduce_sum(input_tensor, reduction_indices=None, keep_dims=False, name=None)

http://www.tensorfly.cn/tfdoc/api_docs/python/math_ops.html#reduce_sum 

6.3.10. NN

Activation Functions

tf.nn.relu(features, name=None)

http://www.tensorfly.cn/tfdoc/api_docs/python/nn.html#relu

tf.nn.dropout(x, keep_prob, noise_shape=None, seed=None, name=None)

http://www.tensorfly.cn/tfdoc/api_docs/python/nn.html#dropout

Convolution

tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None, name=None)

http://www.tensorfly.cn/tfdoc/api_docs/python/nn.html#conv2d 

Pooling

tf.nn.max_pool(value, ksize, strides, padding, name=None)

http://www.tensorfly.cn/tfdoc/api_docs/python/nn.html#max_pool

6.3.13. STATE OPS

tf.initialize_all_variables()

http://www.tensorfly.cn/tfdoc/api_docs/python/state_ops.html#initialize_all_variables

tf.random_normal_initializer(mean=0.0, stddev=1.0, seed=None)

http://www.tensorfly.cn/tfdoc/api_docs/python/state_ops.html#random_normal_initializer

tf.constant_initializer(value=0.0)

http://www.tensorfly.cn/tfdoc/api_docs/python/state_ops.html#constant_initializer

class tf.train.Saver:

tf.train.Saver.save(sess, save_path, global_step=None, latest_filename=None)

tf.train.Saver.restore(sess, save_path)

http://www.tensorfly.cn/tfdoc/api_docs/python/state_ops.html#Saver

tf.train.get_checkpoint_state(checkpoint_dir, latest_filename=None)

http://www.tensorfly.cn/tfdoc/api_docs/python/state_ops.html#get_checkpoint_state

6.3.14. TRAIN

class tf.train.GradientDescentOptimizer(learning_rate=?)

http://www.tensorfly.cn/tfdoc/api_docs/python/train.html#GradientDescentOptimizer

-----------------------------------------------------------------------------------------------------------------------------------

tf.summary.histogram

以上是关于6 API DOC —— Python API的主要内容,如果未能解决你的问题,请参考以下文章

利用sphinx为python项目生成API文档

Yandex.Direct - Python 中的 API

阿里云的api市场

[dev] Go语言查看doc与生成API doc

使用swagger作为restful api的doc文档生成

编写 Gradle 插件时的 Gradle Api Sources 和 Doc