PyTorch: Bind _prims_common contiguity checks to the C++ helpers (#199322)
Addresses review on #198875 and #199322 : _prims_common's contiguity checks had their own Python implementations alongside the C++ ones in c10/core/Contiguity.h.
Executive Summary
Addresses review on #198875 and #199322 : _prims_common's contiguity checks had their own Python implementations alongside the C++ ones in c10/core/Contiguity.h. Both paths now call the C++ helpers through torch._C, so there is one implementation. The false_if_dde=True paths call c10::_is_contiguous_or_false, _is_channels_last_contiguous_2d_or_false and _is_channels_last_contiguous_3d_or_false, which match the Python guard_or_false versions.
Artificial Intelligence Architecture & Model Evaluation
From an artificial intelligence architecture, model weights governance, and inference efficiency perspective: - **Weights Accessibility & Sovereignty:** Evaluates whether weights are open for private self-hosting or locked behind centralized cloud APIs. - **Quantization & Edge Performance:** Kernel optimizations (4-bit/8-bit GGUF, AWQ, EXL2) allow high tokens-per-second on consumer GPUs and Apple Silicon. - **Reasoning & Architectural Scaling:** Scrutinizes mixture-of-experts (MoE), attention mechanisms, and fine-tuning datasets against open community benchmarks.
Impact on the Open Ecosystem
Protects developers and enterprises from proprietary black-box entrapment, fostering auditable, sovereign AI infrastructure.