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

Function _zero_state_tensors

tensorflow/python/ops/rnn_cell_impl.py:167–179  ·  view source on GitHub ↗

Create tensors of zeros based on state_size, batch_size, and dtype.

(state_size, batch_size, dtype)

Source from the content-addressed store, hash-verified

165
166
167def _zero_state_tensors(state_size, batch_size, dtype):
168 """Create tensors of zeros based on state_size, batch_size, and dtype."""
169
170 def get_state_shape(s):
171 """Combine s with batch_size to get a proper tensor shape."""
172 c = _concat(batch_size, s)
173 size = array_ops.zeros(c, dtype=dtype)
174 if not context.executing_eagerly():
175 c_static = _concat(batch_size, s, static=True)
176 size.set_shape(c_static)
177 return size
178
179 return nest.map_structure(get_state_shape, state_size)
180
181
182@tf_export(v1=["nn.rnn_cell.RNNCell"])

Callers 5

_createFunction · 0.85
initial_alignmentsMethod · 0.85
initial_alignmentsMethod · 0.85
zero_stateMethod · 0.85
zero_stateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected