class_docstr: Self attention layer for nd.
class_docstr_tok: ["Self","attention","layer","for","nd","."]
code: def __init__(self, n_channels):
      super().__init__()
      self.query = conv1d(n_channels, n_channels // 8)
      self.key = conv1d(n_channels, n_channels // 8)
      self.value = conv1d(n_channels, n_channels)
      self.gamma = self.create_parameter(
          shape=[1],
          default_initializer=paddle.nn.initializer.Constant(0.0),
      )
  
imports: import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle.vision.models import resnet101
  from .None import utils
label_desc: Use image node_id 1 to create a new SelfAttention object from inherited base classes: nn with example: obj = SelfAttention(n_channels)