{"record":{"id":"9bb0b8d40c41aa64","repo":"tensorflow/models","slug":"external-states-should-be-used-with-causal-mode","errorCode":null,"errorMessage":"External states should be used with causal mode.","messagePattern":"External states should be used with causal mode\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/movinet/modeling/movinet.py","lineNumber":399,"sourceCode":"    self._conv_type = conv_type\n    self._se_type = se_type\n    self._input_specs = input_specs\n    self._use_sync_bn = use_sync_bn\n    self._activation = activation\n    self._gating_activation = gating_activation\n    self._norm_momentum = norm_momentum\n    self._norm_epsilon = norm_epsilon\n    self._norm = tf_keras.layers.BatchNormalization\n    self._kernel_initializer = kernel_initializer\n    self._kernel_regularizer = kernel_regularizer\n    self._bias_regularizer = bias_regularizer\n    self._stochastic_depth_drop_rate = stochastic_depth_drop_rate\n    self._use_external_states = use_external_states\n    self._output_states = output_states\n    self._average_pooling_type = average_pooling_type\n\n    if self._use_external_states and not self._causal:\n      raise ValueError('External states should be used with causal mode.')\n    if not isinstance(block_specs[0], StemSpec):\n      raise ValueError(\n          'Expected first spec to be StemSpec, got {}'.format(block_specs[0]))\n    if not isinstance(block_specs[-1], HeadSpec):\n      raise ValueError(\n          'Expected final spec to be HeadSpec, got {}'.format(block_specs[-1]))\n    self._head_filters = block_specs[-1].head_filters\n\n    state_specs = None\n    if use_external_states:\n      self._set_dtype_policy(input_specs.dtype)\n      state_specs = self.initial_state_specs(input_specs.shape)\n\n    inputs, outputs = self._build_network(input_specs, state_specs=state_specs)\n\n    super(Movinet, self).__init__(inputs=inputs, outputs=outputs, **kwargs)\n\n    self._state_specs = state_specs","sourceCodeStart":381,"sourceCodeEnd":417,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/movinet/modeling/movinet.py#L381-L417","documentation":"Error \"External states should be used with causal mode.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/movinet/modeling/movinet.py:399 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}