<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def forward(self, data_batch, is_train=None, carry_state=True):
 """Forward computation. States from previous forward computation are carried to the current iteration if `carry_state` is set to `True`. """

        # propagate states from the previous iteration
        if carry_state:
            if isinstance(self._next_states, (int, float)):
                self._module.set_states(value=self._next_states)
            else:
                self._module.set_states(states=self._next_states)
        self._module.forward(data_batch, is_train=is_train)
        outputs = self._module.get_outputs(merge_multi_context=False)
        self._next_states = outputs[:-1]