Create tensors of zeros based on state_size, batch_size, and dtype.
(state_size, batch_size, dtype)
| 165 | |
| 166 | |
| 167 | def _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"]) |
no outgoing calls
no test coverage detected