rustorch 0.6.26

Production-ready PyTorch-compatible deep learning library in Rust with special mathematical functions (gamma, Bessel, error functions), statistical distributions, Fourier transforms (FFT/RFFT), matrix decomposition (SVD/QR/LU/eigenvalue), automatic differentiation, neural networks, computer vision transforms, complete GPU acceleration (CUDA/Metal/OpenCL), SIMD optimizations, parallel processing, WebAssembly browser support, comprehensive distributed learning support, and performance validation
Documentation
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# RusTorch CoreML Integration - Python Bindings\n",
    "\n",
    "Dieses Notebook zeigt, wie Sie die CoreML-Funktionalität von RusTorch über Python-Bindings nutzen."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Setup und Imports"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# RusTorch Python-Bindings importieren\n",
    "try:\n",
    "    import rustorch\n",
    "    print(f\"✅ RusTorch Version: {rustorch.__version__}\")\n",
    "    print(f\"📝 Beschreibung: {rustorch.__description__}\")\n",
    "    print(f\"👥 Autor: {rustorch.__author__}\")\n",
    "except ImportError as e:\n",
    "    print(f\"❌ RusTorch Import fehlgeschlagen: {e}\")\n",
    "    print(\"Bitte mit maturin develop erstellen\")\n",
    "    exit(1)\n",
    "\n",
    "import numpy as np\n",
    "import platform\n",
    "\n",
    "print(f\"🖥️ Platform: {platform.system()} {platform.release()}\")\n",
    "print(f\"🐍 Python Version: {platform.python_version()}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## CoreML-Verfügbarkeit prüfen"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# CoreML-Funktionalität prüfen\n",
    "try:\n",
    "    # Prüfen, ob CoreML verfügbar ist\n",
    "    coreml_available = rustorch.is_coreml_available()\n",
    "    print(f\"🍎 CoreML verfügbar: {coreml_available}\")\n",
    "    \n",
    "    if coreml_available:\n",
    "        print(\"🎉 CoreML ist verfügbar!\")\n",
    "        \n",
    "        # Geräteinformationen abrufen\n",
    "        device_info = rustorch.get_coreml_device_info()\n",
    "        print(\"📱 CoreML-Geräteinformationen:\")\n",
    "        print(device_info)\n",
    "    else:\n",
    "        print(\"⚠️ CoreML ist nicht verfügbar\")\n",
    "        if platform.system() != \"Darwin\":\n",
    "            print(\"CoreML ist nur auf macOS verfügbar\")\n",
    "        else:\n",
    "            print(\"CoreML-Features sind möglicherweise nicht aktiviert\")\n",
    "            \n",
    "except AttributeError:\n",
    "    print(\"❌ CoreML-Funktionen nicht gefunden\")\n",
    "    print(\"Möglicherweise nicht mit CoreML-Features erstellt\")\n",
    "    coreml_available = False\n",
    "except Exception as e:\n",
    "    print(f\"❌ Fehler beim Prüfen von CoreML: {e}\")\n",
    "    coreml_available = False"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## CoreML-Geräteerstellung und -operationen"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "if coreml_available:\n",
    "    try:\n",
    "        # CoreML-Gerät erstellen\n",
    "        device = rustorch.CoreMLDevice(device_id=0)\n",
    "        print(f\"🖥️ CoreML-Gerät erstellt: {device}\")\n",
    "        \n",
    "        # Geräteinformationen abrufen\n",
    "        print(f\"🆔 Geräte-ID: {device.device_id()}\")\n",
    "        print(f\"✅ Verfügbar: {device.is_available()}\")\n",
    "        print(f\"💾 Speicherlimit: {device.memory_limit()} Bytes\")\n",
    "        print(f\"🧮 Berechnungseinheiten-Limit: {device.compute_units_limit()}\")\n",
    "        print(f\"📚 Modell-Cache-Größe: {device.model_cache_size()}\")\n",
    "        \n",
    "        # Cache-Bereinigung\n",
    "        device.cleanup_cache()\n",
    "        print(\"🧹 Cache bereinigt\")\n",
    "        \n",
    "    except Exception as e:\n",
    "        print(f\"❌ CoreML-Geräteoperationsfehler: {e}\")\n",
    "else:\n",
    "    print(\"⚠️ Geräteoperationen übersprungen, da CoreML nicht verfügbar ist\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Zusammenfassung und nächste Schritte"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(\"📋 RusTorch CoreML Integration Zusammenfassung:\")\n",
    "print()\n",
    "print(\"✅ Abgeschlossene Punkte:\")\n",
    "print(\"  • Jupyter-Umgebung eingerichtet\")\n",
    "print(\"  • Rust-Kernel und Python-Bindings erstellt\")\n",
    "print(\"  • CoreML-Verfügbarkeit geprüft\")\n",
    "print(\"  • Geräteverwaltung und -konfiguration\")\n",
    "print(\"  • Backend-Statistiken und Profiling\")\n",
    "print(\"  • Intelligente Geräteauswahl\")\n",
    "print()\n",
    "print(\"🚧 Zukünftige Entwicklung:\")\n",
    "print(\"  • Tatsächliche CoreML-Operationsimplementierung\")\n",
    "print(\"  • Performance-Benchmarking\")\n",
    "print(\"  • Mehr Aktivierungsfunktionen und Layer-Typen\")\n",
    "print(\"  • Verbesserung der Fehlerbehandlung\")\n",
    "print(\"  • Speicheroptimierung\")\n",
    "\n",
    "if coreml_available:\n",
    "    print(\"\\n🎉 Glückwunsch! CoreML ist verfügbar und alle Features können getestet werden.\")\n",
    "else:\n",
    "    print(\"\\n⚠️ CoreML ist nicht verfügbar, aber Grundfunktionen funktionieren.\")\n",
    "    print(\"   Wir empfehlen, mit aktivierten CoreML-Features auf macOS zu erstellen.\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.19"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}