# segment\_softmax

````
    description: 'layer segment_softmax for configurable component'
    ---

    # segment_softmax layer

    `segment_softmax` is a custom layer that allows for masking multiple output channels.

    Suppose you have 30 channels and `segment_softmax 3`. First, the 30 channels split into 15/15.
    The first 15 will be used for softmax and multiplied against the second.
    Then each channel is softmaxed, multiplied, and summed.

    So 30 input channels with 3 output channels equate to 5 input channels for each output channel.

    ## input size

    Any 4-d tensor of the shape `[B, C, H, W]`

    ## output size

    [B, OUTPUT_CHANNELS, H, W]

    ## syntax

    ```json
      "segment_softmax OUTPUT_CHANNELS"
    ```

    ## examples

    At the end of the generator for RGB images:

    ```json
      "conv 30",
      "segment_softmax 3",
      "hardtanh"
    ```
````


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hypergan.gitbook.io/hypergan/components/layers/segment_softmax.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
