| 1873 | return self._cell.zero_state(batch_size, dtype) |
| 1874 | |
| 1875 | def __call__(self, inputs, state, scope=None): |
| 1876 | if self._compile_stateful: |
| 1877 | compile_ops = True |
| 1878 | else: |
| 1879 | |
| 1880 | def compile_ops(node_def): |
| 1881 | global _REGISTERED_OPS |
| 1882 | if _REGISTERED_OPS is None: |
| 1883 | _REGISTERED_OPS = op_def_registry.get_registered_ops() |
| 1884 | return not _REGISTERED_OPS[node_def.op].is_stateful |
| 1885 | |
| 1886 | with jit.experimental_jit_scope(compile_ops=compile_ops): |
| 1887 | return self._cell(inputs, state, scope=scope) |
| 1888 | |
| 1889 | |
| 1890 | def _random_exp_initializer(minval, maxval, seed=None, dtype=dtypes.float32): |