class_docstr: The same as vivit block. Supports object attention and masked tokens.
class_docstr_tok: ["The","same","as","vivit","block",".","Supports","object","attention","and","masked","tokens","."]
code: def get_drop_pattern(self, x, deterministic):
      if not deterministic and self.droplayer_p:
          shape = (x.shape[0],) + (1,) * (x.ndim - 1)
          return jax.random.bernoulli(
              self.make_rng("dropout"), self.droplayer_p, shape
          ).astype("float32")
      else:
          return 0.0
  
file_path: scenic/scenic/projects/objectvivit/object_attention.py
imports: import functools
  from typing import Any, Callable, Iterable, Optional
  import flax.linen
  import jax
  import jax.numpy
  import ml_collections
  from scenic.model_lib.layers import attention_layers
label_desc: Use image node_id 1 for calling the ObjectBlock obj's underlying member method code with example usage: obj.get_drop_pattern(x, deterministic) and returns: jax, int