Home / Function/ __post_init__() — pytorch Function Reference

__post_init__() — pytorch Function Reference

Architecture documentation for the __post_init__() function in generate_kernels.py from the pytorch codebase.

Entity Profile

Dependency Diagram

graph TD
  b6356833_87b5_3a29_f757_dbd0dd087434["__post_init__()"]
  09ea15c6_e3f3_3717_43c9_3ba9e722f8e2["__post_init__()"]
  09ea15c6_e3f3_3717_43c9_3ba9e722f8e2 -->|calls| b6356833_87b5_3a29_f757_dbd0dd087434
  09ea15c6_e3f3_3717_43c9_3ba9e722f8e2["__post_init__()"]
  b6356833_87b5_3a29_f757_dbd0dd087434 -->|calls| 09ea15c6_e3f3_3717_43c9_3ba9e722f8e2
  style b6356833_87b5_3a29_f757_dbd0dd087434 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

aten/src/ATen/native/transformers/cuda/mem_eff_attention/kernels/generate_kernels.py lines 160–175

    def __post_init__(self) -> None:
        # Set kernel selection priority
        # The lowest value that matches inputs
        # will be selected
        self.sort_index = (
            # First select aligned kernel
            0 if self.aligned else 1,
            # Take a kernel without dropout if possible
            1 if self.apply_dropout else 0,
            # Then take the smallest maxK
            self.max_k,
            # .. and the highest block_i
            -self.block_i,
            # and finally avoid bounds-checks if possible
            0 if self.keys_queries_aligned_to_blocksizes else 1,
        )

Subdomains

Called By

Frequently Asked Questions

What does __post_init__() do?
__post_init__() is a function in the pytorch codebase.
What does __post_init__() call?
__post_init__() calls 1 function(s): __post_init__.
What calls __post_init__()?
__post_init__() is called by 1 function(s): __post_init__.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free