code: def add_embedding(self, name, W, b, input_dim, output_channels, has_bias,
                        input_name, output_name):
          
  
          spec = self.spec
          nn_spec = self.nn_spec
  
          # Add a new layer
          spec_layer = nn_spec.layers.add()
          spec_layer.name = name
          spec_layer.input.append(input_name)
          spec_layer.output.append(output_name)
  
          # Fill in the parameters
          spec_layer_params = spec_layer.embedding
  
          spec_layer_params.inputDim = input_dim
          spec_layer_params.outputChannels = output_channels
          spec_layer_params.hasBias = has_bias
  
          weights = spec_layer_params.weights
          weights.floatValue.extend(map(float, W.flatten()))
          if has_bias:
              bias = spec_layer_params.bias
              bias.floatValue.extend(map(float, b.flatten()))
docs: Add an embedding layer to the model.
  
          Parameters
          ----------
          name: str
              The name of this layer
          W: numpy.array
              Weight matrix of shape (output_channels, input_dim).
          b: numpy.array
              Bias vector of shape (output_channels, ).
          input_dim: int
              Size of the vocabulary (1 + maximum integer index of the words).
          output_channels: int
              Number of output channels.
          has_bias: boolean
              Whether the bias vector of this layer is ignored in the spec.
  
              - If True, the bias vector of this layer is not ignored.
              - If False, the bias vector is ignored.
  
          input_name: str
              The input blob name of this layer.
          output_name: str
              The output blob name of this layer.
  
          See Also
          --------
          add_inner_product