MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / call

Method call

tensorflow/contrib/eager/python/examples/rnn_ptb/rnn_ptb.py:58–75  ·  view source on GitHub ↗
(self, input_seq, training)

Source from the content-addressed store, hash-verified

56 ])
57
58 def call(self, input_seq, training):
59 batch_size = int(input_seq.shape[1])
60 for c in self.cells:
61 state = c.zero_state(batch_size, tf.float32)
62 outputs = []
63 input_seq = tf.unstack(input_seq, num=int(input_seq.shape[0]), axis=0)
64 for inp in input_seq:
65 output, state = c(inp, state)
66 outputs.append(output)
67
68 input_seq = tf.stack(outputs, axis=0)
69 if training:
70 input_seq = tf.nn.dropout(input_seq, self.keep_ratio)
71 # Returning a list instead of a single tensor so that the line:
72 # y = self.rnn(y, ...)[0]
73 # in PTBModel.call works for both this RNN and CudnnLSTM (which returns a
74 # tuple (output, output_states).
75 return [input_seq]
76
77
78class Embedding(layers.Layer):

Callers

nothing calls this directly

Calls 6

cClass · 0.85
zero_stateMethod · 0.45
unstackMethod · 0.45
appendMethod · 0.45
stackMethod · 0.45
dropoutMethod · 0.45

Tested by

no test coverage detected