code: def local_self_attention_layer(hparams, prefix):
    
    return transformer_layers.LocalSelfAttention(
        num_heads=hparams.get(prefix + "num_heads"),
        num_memory_heads=hparams.get(prefix + "num_memory_heads"),
        radius=hparams.local_attention_radius,
        key_value_size=hparams.d_kv,
        shared_kv=hparams.get(prefix + "shared_kv", False),
        attention_kwargs=attention_kwargs_from_hparams(hparams))
docs: Create self-attention layer based on hyperparameters.