class_docstr: [`FlaxSpeechEncoderDecoderModel`] is a generic model class that will be instantiated as a transformer architecture
  with the module (flax.nn.Module) of one of the base model classes of the library as encoder module and another one
  as decoder module when created with the :meth*~transformers.FlaxAutoModel.from_pretrained* class method for the
  encoder and :meth*~transformers.FlaxAutoModelForCausalLM.from_pretrained* class method for the decoder.
class_docstr_tok: ["[","`","FlaxSpeechEncoderDecoderModel","`","]","is","a","generic","model","class","that","will","be","instantiated","as","a","transformer","architecture","with","the","module","(","flax.nn.Module",")","of","one","of","the","base","model","classes","of","the","library","as","encoder","module","and","another","one","as","decoder","module","when","created","with","the",":","meth","*","~transformers.FlaxAutoModel.from_pretrained","*","class","method","for","the","encoder","and",":","meth","*","~transformers.FlaxAutoModelForCausalLM.from_pretrained","*","class","method","for","the","decoder","."]
docstr: Returns:
  
  Example:
  
  ```python
  >>> from transformers import FlaxSpeechEncoderDecoderModel
  
  >>> # initialize a wav2vec2-2-bart from pretrained wav2vec2 and bart models. Note that the cross-attention layers will be randomly initialized
  >>> model = FlaxSpeechEncoderDecoderModel.from_encoder_decoder_pretrained(
  ...     "facebook/wav2vec2-large-lv60", "facebook/bart-large"
  ... )
  
  >>> inputs = jnp.ones((2, 5000), dtype=jnp.float32)
  >>> encoder_outputs = model.encode(inputs)
  ```
docstr_tok: ["Returns",":","Example",":","``","`","python",">",">",">","from","transformers","import","FlaxSpeechEncoderDecoderModel",">",">",">","#","initialize","a","wav2vec2-2-bart","from","pretrained","wav2vec2","and","bart","models",".","Note","that","the","cross-attention","layers","will","be","randomly","initialized",">",">",">","model","=","FlaxSpeechEncoderDecoderModel.from_encoder_decoder_pretrained","(","...","``","facebook\/wav2vec2-large-lv60","''",",","``","facebook\/bart-large","''","...",")",">",">",">","inputs","=","jnp.ones","(","(","2",",","5000",")",",","dtype=jnp.float32",")",">",">",">","encoder_outputs","=","model.encode","(","inputs",")","``","`"]
code: def encode(
      self,
      inputs: jnp.ndarray,
      attention_mask: Optional[jnp.ndarray] = None,
      output_attentions: Optional[bool] = None,
      output_hidden_states: Optional[bool] = None,
      return_dict: Optional[bool] = None,
      train: bool = False,
      freeze_feature_encoder: bool = False,
      params: dict = None,
      dropout_rng: PRNGKey = None,
  ):
      r"""
      Returns:
  
      Example:
  
      ```python
      >>> from transformers import FlaxSpeechEncoderDecoderModel
  
      >>> # initialize a wav2vec2-2-bart from pretrained wav2vec2 and bart models. Note that the cross-attention layers will be randomly initialized
      >>> model = FlaxSpeechEncoderDecoderModel.from_encoder_decoder_pretrained(
      ...     "facebook/wav2vec2-large-lv60", "facebook/bart-large"
      ... )
  
      >>> inputs = jnp.ones((2, 5000), dtype=jnp.float32)
      >>> encoder_outputs = model.encode(inputs)
      ```"""
      output_attentions = (
          output_attentions
          if output_attentions is not None
          else self.config.output_attentions
      )
      output_hidden_states = (
          output_hidden_states
          if output_hidden_states is not None
          else self.config.output_hidden_states
      )
      return_dict = (
          return_dict
          if return_dict is not None
          else self.config.return_dict
      )
  
      if attention_mask is None:
          attention_mask = jnp.ones_like(inputs, dtype="i4")
  
      # Handle any PRNG if needed
      rngs = {}
      if dropout_rng is not None:
          rngs["dropout"] = dropout_rng
  
      def _encoder_forward(module, inputs, attention_mask, **kwargs):
          encode_module = module._get_encoder_module()
          return encode_module(inputs, attention_mask, **kwargs)
  
      outputs = self.module.apply(
          {"params": params or self.params},
          inputs=jnp.array(inputs, dtype="f4"),
          attention_mask=jnp.array(attention_mask, dtype="i4"),
          output_attentions=output_attentions,
          output_hidden_states=output_hidden_states,
          return_dict=return_dict,
          deterministic=not train,
          freeze_feature_encoder=freeze_feature_encoder,
          rngs=rngs,
          method=_encoder_forward,
      )
  
      if return_dict:
          outputs = FlaxBaseModelOutput(
              last_hidden_state=outputs.last_hidden_state,
              hidden_states=outputs.hidden_states,
              attentions=outputs.attentions,
          )
  
      return outputs
  
imports: import os
  from typing import Optional, Tuple, Union
  import flax.linen
  import jax
  import jax.numpy
  from flax.core.frozen_dict import FrozenDict, freeze, unfreeze
  from flax.traverse_util import flatten_dict, unflatten_dict
  from jax import lax
  from jax.random import PRNGKey
  from ...modeling_flax_outputs import FlaxBaseModelOutput, FlaxCausalLMOutputWithCrossAttentions, FlaxSeq2SeqLMOutput
  from ...modeling_flax_utils import FlaxPreTrainedModel
  from ...utils import add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from ..auto.configuration_auto import AutoConfig
  from ..auto.modeling_flax_auto import FlaxAutoModel, FlaxAutoModelForCausalLM
  from .configuration_speech_encoder_decoder import SpeechEncoderDecoderConfig
label_desc: Use image node_id 5 for calling the FlaxSpeechEncoderDecoderModel obj's underlying member method code with example usage: obj.encode(inputs, attention_mask, output_attentions, output_hidden_states, return_dict, train, freeze_feature_encoder, params, dropout_rng) and returns: outputs, encode_module