水平有限,如有错误,请指正!
本文主要介绍一下 tensorflow.python.ops.rnn_cell
中的一些类和函数,可以为我们编程所用
def _linear(args, output_size, bias, bias_start=0.0, scope=None):
batch_size
要保证一样._ref
类型(tf_getvariable(), tf.Variables()返回的都是 _ref
),但这个 _ref
类型经过任何op之后,_ref
就会消失PS: _ref
referente-typed is mutable
class BasicLSTMCell(RNNCell):
def __init__(self, num_units, forget_bias=1.0, input_size=None,
state_is_tuple=True, activation=tanh):
"""
为什么被称为 Basic
It does not allow cell clipping, a projection layer, and does not
use peep-hole connections: it is the basic baseline.
"""
class GRUCell(RNNCell):
def __init__(self, num_units, input_size=None, activation=tanh):
创建一个GRUCell
class LSTMCell(RNNCell):
def __init__(self, num_units, input_size=None,
use_peepholes=False, cell_clip=None,
initializer=None, num_proj=None, proj_clip=None,
num_unit_shards=1, num_proj_shards=1,
forget_bias=1.0, state_is_tuple=True,
activation=tanh):
class OutputProjectionWrapper(RNNCell):
def __init__(self, cell, output_size):
class InputProjectionWrapper(RNNCell):
def __init__(self, cell, num_proj, input_size=None):
class DropoutWrapper(RNNCell):
def __init__(self, cell, input_keep_prob=1.0, output_keep_prob=1.0,
seed=None):
class EmbeddingWrapper(RNNCell):
def __init__(self, cell, embedding_classes, embedding_size, initializer=None):
class MultiRNNCell(RNNCell):
def __init__(self, cells, state_is_tuple=True):
关于LSTM, LSTM(peephole), GRU 请见Understanding LSTM Networks