class_docstr: Implements the sin-cos positional encoding.
class_docstr_tok: ["Implements","the","sin-cos","positional","encoding","."]
docstr: Create the sin-cos tensor of shape [1, length, d_feature].
docstr_tok: ["Create","the","sin-cos","tensor","of","shape","[","1",",","length",",","d_feature","]","."]
code: def _sincos(self, start, length, d_feature):
      """Create the sin-cos tensor of shape [1, length, d_feature]."""
      position = jnp.arange(0, length)[:, None] + start
      div_term = jnp.exp(
          jnp.arange(0, d_feature, 2) * -(jnp.log(10000.0) / d_feature)
      )
      sin = jnp.sin(position * div_term)
      cos = jnp.cos(position * div_term)
      pe = jnp.concatenate([sin, cos], axis=1)
      return pe[None, :, :]
  
imports: import logging
  import jax
  import jax.extend
  import numpy
  import trax
  from trax import fastmath
  from trax.fastmath import numpy
  from trax.layers import base
  from trax.layers import initializers
label_desc: Use image node_id 2 for calling the SinCosPositionalEncoding obj's underlying member method code with example usage: obj._sincos(start, length, d_feature) and returns: pe