Skip to main content
QMSQMS
QMS
  • Welcome to your QMS
  • Quality Manual
  • Procedures
  • Records
  • Legit.Health Plus Version 1.1.0.0
    • CAPA Plan - BSI CE Mark Closeout
    • Index
    • Overview and Device Description
    • Information provided by the Manufacturer
    • Design and Manufacturing Information
      • R-TF-012-019 SOUPs
        • Aioboto3
        • Albumentations
        • Argon2-CFFI
        • Authlib
        • Boto3
        • Dependency Injector
        • Dill
        • FastAPI
        • PyTorch Grad-CAM
        • Httpx
        • NumPy
        • PyNVML
        • OpenCV
        • Pillow
        • Psutil
        • Pydantic
        • Pydantic Settings
        • PyYAML
        • Segmentation Models PyTorch
        • Starlette
        • Timm
        • PyTorch
        • TorchVision
        • Ultralytics YOLO
        • Uvicorn
      • R-TF-012-028 Software Requirement Specification
      • R-TF-012-029 Software Architecture Description
      • R-TF-012-030 Software Configuration Management Plan
      • R-TF-012-031 Product requirements specification
      • R-TF-012-037 Labeling and IFU Requirements
      • R-TF-012-040 Documentation level FDA
      • R-TF-012-041 Software Classification 62304
      • R-TF-012-043 Traceability Matrix
      • Review meetings
    • GSPR
    • Benefit-Risk Analysis and Risk Management
    • Product Verification and Validation
    • Post-Market Surveillance
  • Legit.Health Plus Version 1.1.0.1
  • Legit.Health Utilities
  • Licenses and accreditations
  • Applicable Standards and Regulations
  • Pricing
  • Public tenders
  • Legit.Health Plus Version 1.1.0.0
  • Design and Manufacturing Information
  • R-TF-012-019 SOUPs
  • PyTorch

PyTorch

General Information​

FieldValue
Package Nametorch (PyTorch)
Manufacturer / VendorPyTorch Foundation / Linux Foundation (Meta AI, Google, Microsoft, Amazon, and contributors)
Software CategoryFramework
Primary DocumentationDocumentation, GitHub, PyPI, Tutorials
Programming Language(s)Python, C++, CUDA
LicenseBSD License
Deployed Version(s)>=2.0.0, >=2.1.0 (version-locked at 2.9.1)
Most Recent Available Version2.10.0
Last Review Date2026-01-26

Overview​

PyTorch is an open-source deep learning framework that provides tensor computation with strong GPU acceleration and automatic differentiation for building and training neural networks. Originally developed by Meta AI Research, it is now maintained by the PyTorch Foundation under the Linux Foundation, with contributions from major technology organizations including Google, Microsoft, Amazon, and the broader research community.

Within the medical device software, PyTorch serves as the foundational deep learning framework powering all AI/ML inference capabilities. It is integrated throughout the system architecture:

  • Core inference platform: The PytorchModelAdapter abstraction in the legithp-expert framework provides a standardized interface for loading, executing, and managing all neural network models used by the device
  • Clinical condition classification: Multi-class skin disease classification with integrated clinical metadata (patient sex, age, body site) using custom neural network architectures built on torch.nn.Module
  • Medical image segmentation: Pixel-wise segmentation of skin lesions, hair loss regions, and inflammatory patterns via encoder-decoder architectures (UNet, UNet++, FPN) implemented through segmentation-models-pytorch
  • Explainability generation: GradCAM++ saliency maps that highlight image regions influencing AI predictions, implemented using pytorch-grad-cam
  • GPU resource management: CUDA device enumeration, memory monitoring, utilization tracking, and thermal management through the torch.cuda module
  • Object detection: YOLO-based lesion detection through the Ultralytics library, which uses PyTorch as its backend

PyTorch was selected over alternatives (TensorFlow, JAX, ONNX Runtime) due to:

  • Industry-leading adoption in medical imaging and computer vision research
  • Flexible imperative programming model enabling rapid prototyping and debugging
  • Comprehensive GPU acceleration via CUDA with automatic memory management
  • Strong ecosystem of pre-trained models (timm, torchvision) and architectures (segmentation-models-pytorch)
  • Active maintenance with regular security updates and long-term support
  • BSD license permitting commercial use in medical device software

Functional Requirements​

The following functional capabilities of this SOUP are relied upon by the medical device software.

Requirement IDDescriptionSource / Reference
FR-001Define neural network architectures via composable module APItorch.nn.Module base class
FR-002Execute forward pass inference through neural networksmodel(input) or model.forward(input)
FR-003Disable gradient computation for efficient inference@torch.no_grad() decorator and context manager
FR-004Load serialized model weights from state dictionary filestorch.load() with weights_only=True
FR-005Transfer tensors and models between CPU and GPU devices.to(device) method, torch.device()
FR-006Create tensors with specified values, shapes, and device placementtorch.zeros(), torch.ones(), torch.randn()
FR-007Concatenate and stack tensors along specified dimensionstorch.cat(), torch.stack()
FR-008Detect and enumerate available CUDA-capable GPU devicestorch.cuda.is_available(), torch.cuda.device_count()
FR-009Query GPU device properties (memory, compute capability)torch.cuda.get_device_properties()
FR-010Monitor GPU memory allocation and utilizationtorch.cuda.memory_allocated(), torch.cuda.utilization()
FR-011Synchronize CUDA operations and release cached memorytorch.cuda.synchronize(), torch.cuda.empty_cache()
FR-012Provide fully connected, normalization, activation, and dropout layersnn.Linear, nn.BatchNorm1d, nn.GELU, nn.Dropout
FR-013Perform tensor interpolation for image resizingtorch.nn.functional.interpolate()
FR-014Validate tensor values for numerical stability (NaN/Inf detection)torch.isnan(), torch.isinf()
FR-015Support adaptive pooling for variable input sizesnn.AdaptiveAvgPool2d
FR-016Flatten tensors for transition from convolutional to fully connected layerstorch.flatten()

Performance Requirements​

The following performance expectations are relevant to the medical device software.

Requirement IDDescriptionAcceptance Criteria
PR-001Model inference shall complete within acceptable API latency boundsSingle image inference < 5 seconds on target GPU hardware
PR-002GPU memory usage shall allow concurrent model loading for multi-task pipelinesMultiple expert models fit within allocated GPU memory
PR-003Tensor operations shall maintain IEEE 754 float32 numerical precisionNo loss of precision affecting clinical classification accuracy
PR-004CUDA synchronization shall not introduce significant inference latency overheadSynchronization overhead < 5% of total inference time
PR-005Memory cache clearing shall prevent GPU memory exhaustion during continuous operationNo out-of-memory errors during sustained production workloads

Hardware Requirements​

The following hardware dependencies or constraints are imposed by this SOUP component.

Requirement IDDescriptionNotes / Limitations
HR-001CUDA-compatible NVIDIA GPU required for production inferenceCPU inference supported but not recommended for production latency
HR-002CUDA Compute Capability 3.5 or higherRequired for PyTorch CUDA operations
HR-003Sufficient GPU memory for model weights and intermediate tensorsMinimum 4GB VRAM recommended; varies by model architecture
HR-004x86-64 or ARM64 processor architecturePre-built wheels available for common platforms
HR-005System memory for model loading and data preprocessingMinimum 16GB RAM recommended for model operations

Software Requirements​

The following software dependencies and environmental assumptions are required by this SOUP component.

Requirement IDDescriptionDependency / Version Constraints
SR-001Python runtime environmentPython >=3.10
SR-002NVIDIA CUDA Toolkit for GPU accelerationCUDA 11.8 or 12.x (bundled with PyTorch wheels)
SR-003cuDNN library for deep learning primitivesCompatible version bundled with PyTorch
SR-004NumPy for array interoperabilityCompatible NumPy version for tensor conversion
SR-005NVIDIA driver supporting installed CUDA versionDriver version >=525.60.13 for CUDA 12.x

Known Anomalies Assessment​

This section evaluates publicly reported issues, defects, or security vulnerabilities associated with this SOUP component and their relevance to the medical device software.

Anomaly ReferenceStatusApplicableRationaleReviewed At
CVE-2025-32434 (torch.load RCE with weights_only=True)FixedNoCritical RCE vulnerability (CVSS 9.3) affecting PyTorch <=2.5.1 where torch.load() with weights_only=True could still execute arbitrary code. Fixed in PyTorch 2.6.0; the device uses version-locked PyTorch 2.9.1 which includes the fix2026-01-26
CVE-2025-2953 (mkldnn_max_pool2d DoS)OpenNoDenial of service via mkldnn_max_pool2d function with specific tensor shapes; the device does not use MKL-DNN pooling operations and validates input shapes before inference2026-01-26

In addition to the CVEs listed above, inherent risks in Python's pickle format used by PyTorch model files were considered. These risks are mitigated by using only pre-deployed, internally verified model weights from trusted sources.

PyTorch is actively maintained by the PyTorch Foundation with a robust security response process. The project maintains a security policy and uses GitHub Security Advisories for coordinated disclosure. According to Feedly's vulnerability tracking, the PyTorch team has demonstrated prompt patching of reported vulnerabilities.

The device's usage pattern minimizes attack surface exposure:

  • No untrusted model loading: All neural network weights are pre-deployed, internally verified, and shipped with the device; no model files are loaded from user input or external sources at runtime
  • Version locking: Requirements lock files pin PyTorch to version 2.9.1, which includes fixes for CVE-2025-32434 and all prior critical vulnerabilities
  • Safe deserialization: Model loading uses weights_only=True parameter combined with PyTorch >=2.6.0, providing defense-in-depth against pickle-based attacks
  • Input validation: All inference inputs are validated for shape, type, and numerical range before being passed to PyTorch operations
  • Isolated execution: Model inference runs in containerized environments with restricted filesystem and network access
  • No dynamic code execution: The device uses only forward-pass inference; no training, no torch.compile(), no JIT compilation from untrusted sources

Risk Control Measures​

The following risk control measures are implemented to mitigate potential security and operational risks associated with this SOUP component:

  • Version locking via requirements_lock.txt ensures reproducible, auditable deployments with known-secure versions
  • All model weights are sourced from internal development pipelines with integrity verification
  • Model files are cached and cryptographically verified before deployment
  • Input validation at API boundaries prevents malformed data from reaching PyTorch operations
  • GPU memory management guards prevent resource exhaustion attacks
  • Container isolation limits potential impact of any exploitation

Assessment Methodology​

The following methodology was used to identify and assess known anomalies:

  • Sources consulted:

    • National Vulnerability Database (NVD) search for "pytorch" and "torch"
    • GitHub Security Advisories for pytorch/pytorch
    • PyTorch security policy and disclosure process
    • PyPI package security reports
    • Snyk vulnerability database
    • JFrog security research on pickle-related ML vulnerabilities
  • Criteria for determining applicability:

    • Vulnerability must affect deployed versions (2.9.1)
    • Vulnerability must be exploitable in the device's operational context (production inference, no training)
    • Attack vector must be reachable through the device's interfaces (no external model loading, no untrusted user code execution)
    • Input validation and isolation controls must not mitigate the vulnerability

Signature meaning

The signatures for the approval process of this document can be found in the verified commits at the repository for the QMS. As a reference, the team members who are expected to participate in this document and their roles in the approval process, as defined in Annex I Responsibility Matrix of the GP-001, are:

  • Author: Team members involved
  • Reviewer: JD-003, JD-004
  • Approver: JD-001
Previous
Timm
Next
TorchVision
  • General Information
  • Overview
  • Functional Requirements
  • Performance Requirements
  • Hardware Requirements
  • Software Requirements
  • Known Anomalies Assessment
    • Risk Control Measures
    • Assessment Methodology
All the information contained in this QMS is confidential. The recipient agrees not to transmit or reproduce the information, neither by himself nor by third parties, through whichever means, without obtaining the prior written permission of Legit.Health (AI Labs Group S.L.)