Home / Function/ condition() — pytorch Function Reference

condition() — pytorch Function Reference

Architecture documentation for the condition() function in generate-wrapper.py from the pytorch codebase.

Entity Profile

Relationship Graph

Source Code

aten/src/ATen/native/quantized/cpu/qnnpack/generate-wrapper.py lines 113–132

    for condition, filenames in QNNPACK_SOURCES.items():
        for filename in filenames:
            filepath = os.path.join("wrappers", filename)
            if not os.path.isdir(os.path.dirname(filepath)):
                os.makedirs(os.path.dirname(filepath))
            with open(filepath, "w") as wrapper:
                print(BANNER, file=wrapper)
                print(file=wrapper)

                # Architecture- or platform-dependent preprocessor flags can be
                # defined here. Note: platform_preprocessor_flags can't be used
                # because they are ignored by arc focus & buck project.

                if condition is None:
                    print(f"#include <{filename}>", file=wrapper)
                else:
                    # Include source file only if condition is satisfied
                    print(f"#if {condition}", file=wrapper)
                    print(f"#include <{filename}>", file=wrapper)
                    print(f"#endif /* {condition} */", file=wrapper)

Subdomains

Analyze Your Own Codebase

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

Try Supermodel Free