class_docstr: A vectorized sinusoidal encoding.
  
  Attributes:
    num_freqs: the number of frequency bands in the encoding.
    min_freq_log2: the log (base 2) of the lower frequency.
    max_freq_log2: the log (base 2) of the upper frequency.
    scale: a scaling factor for the positional encoding.
    use_identity: if True use the identity encoding as well.
class_docstr_tok: ["A","vectorized","sinusoidal","encoding",".","Attributes",":","num_freqs",":","the","number","of","frequency","bands","in","the","encoding",".","min_freq_log2",":","the","log","(","base","2",")","of","the","lower","frequency",".","max_freq_log2",":","the","log","(","base","2",")","of","the","upper","frequency",".","scale",":","a","scaling","factor","for","the","positional","encoding",".","use_identity",":","if","True","use","the","identity","encoding","as","well","."]
docstr: A vectorized sinusoidal encoding.
  
  Args:
    x: the input features to encode.
    alpha: a dummy argument for API compatibility.
  
  Returns:
    A tensor containing the encoded features.
docstr_tok: ["A","vectorized","sinusoidal","encoding",".","Args",":","x",":","the","input","features","to","encode",".","alpha",":","a","dummy","argument","for","API","compatibility",".","Returns",":","A","tensor","containing","the","encoded","features","."]
code: def __call__(self, x, alpha: Optional[float] = None):
      """A vectorized sinusoidal encoding.
  
      Args:
        x: the input features to encode.
        alpha: a dummy argument for API compatibility.
  
      Returns:
        A tensor containing the encoded features.
      """
      if self.num_freqs == 0:
          return x
  
      x_expanded = jnp.expand_dims(x, axis=-2)  # (1, C).
      # Will be broadcasted to shape (F, C).
      angles = self.scale * x_expanded * self.freqs
  
      # The shape of the features is (F, 2, C) so that when we reshape it
      # it matches the ordering of the original NeRF code.
      # Vectorize the computation of the high-frequency (sin, cos) terms.
      # We use the trigonometric identity: cos(x) = sin(x + pi/2)
      features = jnp.stack((angles, angles + jnp.pi / 2), axis=-2)
      features = features.flatten()
      features = jnp.sin(features)
  
      # Prepend the original signal for the identity.
      if self.use_identity:
          features = jnp.concatenate([x, features], axis=-1)
      return features
  
imports: import functools
  from typing import Optional, Tuple
  from flax import linen
  import jax
  import jax.numpy
  from nerfies import types
label_desc: Use image node_id 2 for calling the SinusoidalEncoder obj's underlying member method code with example usage: obj.__call__(x, alpha) and returns: features, x