جريدة مانشيتجريدة مانشيت
جريدة مانشيت
القائمة
البحث
جريدة مانشيتجريدة مانشيت
جريدة مانشيت
  • أخبار دوليّة
  • أخبار مصر
  • تجارة وأعمال
  • رياضة
  • تكنولوجيا
  • ترفيه
الرئيسية أخبار مصر الصفحة 11

أخبار مصر

كل التصنيفات:
أخبار الرياضة
أخبار دوليّة
أخبار مصر
العلوم والتكنولوجيا
تجارة وأعمال
ترفيه
مادة إعلانية
صفحات:
عرض المزيد
« الصفحة السابقة 1 … 9 10 11 12 13 … 18 التالي »
  • عدوى وجفاف القصر الملكي في النرويج يكشف تطورات الحالة الصحية

    عدوى وجفاف.. القصر الملكي في النرويج يكشف تطورات الحالة الصحية للملك هارلد الخامس

    آخر تحديث25 فبراير 2026 - 10:13صفيأخبار مصر
  • رسميًا داخل معهد ناصر وزير الصحة يعلن بدء تشغيل أول

    رسميًا داخل معهد ناصر.. وزير الصحة يعلن بدء تشغيل أول روبوت جراحي في مصر ومنطقة الشرق الأوسط

    آخر تحديث25 فبراير 2026 - 10:09صفيأخبار مصر
  • الخميس المقبل موعد نهائي لاستقبال استمارات طلاب الثانوية العامة قبل

    الخميس المقبل.. موعد نهائي لاستقبال استمارات طلاب الثانوية العامة قبل إغلاق التقديم

    آخر تحديث25 فبراير 2026 - 10:06صفيأخبار مصر
  • Initialize model and train

    linear_regressor = LinearRegressor() linear_regressor.train(inputs, labels)

    print(f”Trained weight: {linear_regressor.model.parameters.m.value}”) print(f”Trained bias: {linear_regressor.model.parameters.b.value}”)

    Challenges and Future Considerations:

    • Computation Graph Optimization: In industrial-scale frameworks like PyTorch or TensorFlow, computation graphs are often more complex. They use Tape-based or Static Graph approaches for better efficiency.
    • Control Flows (If, For, While): Handling dynamic control flows during the forward pass requires advanced graph recording mechanisms.
    • Complex Data Types: Supporting tensors of various dimensions and multi-input/multi-output functions.
    • Higher-Order Derivatives: Calculating the derivative of a derivative.

    Conclusion:

    Understanding the core of a deep learning framework is about understanding Autograd. It shows that even a complex-looking process like backpropagation is just a series of chain-rule operations applied systematically. You could extend this mini-framework to handle multi-dimensional tensors, a library of more complex functions (like torch.exp or torch.sin), and more sophisticated optimization algorithms.

    ### Building a Custom Autograd System (Mini-PyTorch)

    Creating an automatic differentiation system from scratch is an excellent way to grasp how deep learning frameworks compute gradients. In this guide, we’ll build a simple scalar-based autograd engine similar to micrograd (by Andrej Karpathy), which focuses on the core mechanics without the complexity of multi-dimensional tensors.


    Core Concept: The Computational Graph

    Autograd works by building a Directed Acyclic Graph (DAG) during the “forward pass.”

    • Nodes: Represent operands (values/scalars).
    • Edges: Represent the operations that connect them.
    • Backpropagation: We traverse this graph in reverse to apply the Chain Rule.

    Step 1: The Value Class

    This class will store a scalar value, its gradient, and a reference to the operations that created it.

    python import math

    class Value: def init(self, data, _children=(), _op=”): self.data = data self.grad = 0.0 # Hidden state: d(Result)/d(self) self._prev = set(_children) # Previous nodes in the graph self._op = _op # The operation that produced this node self._backward = lambda: None # Function to compute local gradient

    def __repr__(self):
        return f"Value(data={self.data}, grad={self.grad})"
    
    # Addition: c = a + b
    def __add__(self, other):
        other = other if isinstance(other, Value) else Value(other)
        out = Value(self.data + other.data, (self, other), '+')
    
        def _backward():
            # Chain rule: dL/da = dL/dc * dc/da. For addition, dc/da = 1.
            self.grad += 1.0 * out.grad
            other.grad += 1.0 * out.grad
        out._backward = _backward
    
        return out
    
    # Multiplication: c = a * b
    def __mul__(self, other):
        other = other if isinstance(other, Value) else Value(other)
        out = Value(self.data * other.data, (self, other), '*')
    
        def _backward():
            # Chain rule: dL/da = dL/dc * dc/da. For multiplication, dc/da = b.
            self.grad += other.data * out.grad
            other.grad += self.data * out.grad
        out._backward = _backward
    
        return out
    
    # Power: c = a^n
    def __pow__(self, other):
        assert isinstance(other, (int, float)), "Supporting only int/float powers"
        out = Value(self.data**other, (self,), f'^{other}')
    
        def _backward():
            # Power rule: d(x^n)/dx = n * x^(n-1)
            self.grad += (other * (self.data**(other-1))) * out.grad
        out._backward = _backward
    
        return out
    
    def relu(self):
        out = Value(0 if self.data < 0 else self.data, (self,), 'ReLU')
    
        def _backward():
            self.grad += (1.0 if out.data > 0 else 0) * out.grad
        out._backward = _backward
        return out
    
    def backward(self):
        """Topological sort to ensure we compute gradients in the right order."""
        topo = []
        visited = set()
        def build_topo(v):
            if v not in visited:
                visited.add(v)
                for child in v._prev:
                    build_topo(child)
                topo.append(v)
    
        build_topo(self)
    
        # Initial gradient is 1 (dOut/dOut)
        self.grad = 1.0
        for node in reversed(topo):
            node._backward()
    
    # Boilerplate for operator overloading
    def __neg__(self): return self * -1
    def __sub__(self, other): return self + (-other)
    def __rmul__(self, other): return self * other
    def __truediv__(self, other): return self * (other**-1)

    Step 2: Testing the Engine

    Let’s see if we can calculate the gradient of a simple function: $f(x, y) = (x \cdot y) + y^2$.

    python x = Value(2.0) y = Value(3.0)

    f = (x * y) + y^2

    f = (2 * 3) + 3^2 = 6 + 9 = 15

    f = (x * y) + (y ** 2)

    f.backward()

    print(f”Result: {f.data}”) # Should be 15.0 print(f”df/dx: {x.grad}”) # df/dx = y = 3.0 print(f”df/dy: {y.grad}”) # df/dy = x + 2y = 2 + 6 = 8.0


    Step 3: Minimal Neural Network Logic

    Now that we have the autograd engine, we can build a Neuron and Layer.

    python import random

    class Neuron: def init(self, nin): self.w = [Value(random.uniform(-1, 1)) for _ in range(nin)] self.b = Value(random.uniform(-1, 1))

    def __call__(self, x):
        # w * x + b
        act = sum((wi*xi for wi, xi in zip(self.w, x)), self.b)
        return act.relu()
    
    def parameters(self):
        return self.w + [self.b]

    Example Usage

    n = Neuron(2) x = [Value(1.0), Value(-2.0)] y = n(x) y.backward()

    print(f”Neuron Output: {y.data}”) print(f”Gradient of first weight: {n.w[0].grad}”)


    Key Takeaways for Your Implementation

    1. Gradient Accumulation (+=): We use += for self.grad because if a variable is used multiple times in a graph, its gradients must be summed (the Multivariate Chain Rule).
    2. Topological Sort: In the backward() method, you cannot calculate a node’s gradient until you have processed all nodes that depend on it. A topological sort ensures we move from the output back to the inputs correctly.
    3. Operator Overloading: Overloading __add__ and __mul__ allows you to write natural Python math code (a + b) while the Value class secretly builds the graph in the background.
    4. Zero Grad: In a real training loop, you must call grad = 0 between iterations, otherwise gradients from the previous step will keep adding to the new ones.

    This architecture is the fundamental “DNA” of PyTorch’s Variable and Function classes, scaled up to handle N-dimensional tensors and GPU acceleration.

    ">
    تحركات الذهب توقعات أسعار المعدن الأصفر في مصر خلال تعاملات

    تحركات الذهب.. توقعات أسعار المعدن الأصفر في مصر خلال تعاملات الأربعاء_

    # define the linear model with initial values for intercept and coefficient
    self.model = LinearModel(m=0.0, b=0.0)

    def forward(self, input): return self.model(input)

    def loss(self, labels, predictions): return torch.mean((labels – predictions)**2)

    def train(self, inputs, labels, epochs=100, learning_rate=0.001): for epoch in range(epochs): predictions = self.forward(inputs) loss_val = self.loss(labels, predictions)

      # Zero existing gradients
      self.model.parameters.m.grad = 0.0
      self.model.parameters.b.grad = 0.0
    
      # Compute gradients
      loss_val.backward()
    
      # Optimization step (simulated)
      self.model.parameters.m.value -= learning_rate * self.model.parameters.m.grad
      self.model.parameters.b.value -= learning_rate * self.model.parameters.b.grad
    
      if epoch % 10 == 0:
        print(f"Epoch {epoch}, Loss: {loss_val.item()}")

    Initialize model and train

    linear_regressor = LinearRegressor() linear_regressor.train(inputs, labels)

    print(f”Trained weight: {linear_regressor.model.parameters.m.value}”) print(f”Trained bias: {linear_regressor.model.parameters.b.value}”)

    Challenges and Future Considerations:

    • Computation Graph Optimization: In industrial-scale frameworks like PyTorch or TensorFlow, computation graphs are often more complex. They use Tape-based or Static Graph approaches for better efficiency.
    • Control Flows (If, For, While): Handling dynamic control flows during the forward pass requires advanced graph recording mechanisms.
    • Complex Data Types: Supporting tensors of various dimensions and multi-input/multi-output functions.
    • Higher-Order Derivatives: Calculating the derivative of a derivative.

    Conclusion:

    Understanding the core of a deep learning framework is about understanding Autograd. It shows that even a complex-looking process like backpropagation is just a series of chain-rule operations applied systematically. You could extend this mini-framework to handle multi-dimensional tensors, a library of more complex functions (like torch.exp or torch.sin), and more sophisticated optimization algorithms.

    ### Building a Custom Autograd System (Mini-PyTorch)

    Creating an automatic differentiation system from scratch is an excellent way to grasp how deep learning frameworks compute gradients. In this guide, we’ll build a simple scalar-based autograd engine similar to micrograd (by Andrej Karpathy), which focuses on the core mechanics without the complexity of multi-dimensional tensors.


    Core Concept: The Computational Graph

    Autograd works by building a Directed Acyclic Graph (DAG) during the “forward pass.”

    • Nodes: Represent operands (values/scalars).
    • Edges: Represent the operations that connect them.
    • Backpropagation: We traverse this graph in reverse to apply the Chain Rule.

    Step 1: The Value Class

    This class will store a scalar value, its gradient, and a reference to the operations that created it.

    python import math

    class Value: def init(self, data, _children=(), _op=”): self.data = data self.grad = 0.0 # Hidden state: d(Result)/d(self) self._prev = set(_children) # Previous nodes in the graph self._op = _op # The operation that produced this node self._backward = lambda: None # Function to compute local gradient

    def __repr__(self):
        return f"Value(data={self.data}, grad={self.grad})"
    
    # Addition: c = a + b
    def __add__(self, other):
        other = other if isinstance(other, Value) else Value(other)
        out = Value(self.data + other.data, (self, other), '+')
    
        def _backward():
            # Chain rule: dL/da = dL/dc * dc/da. For addition, dc/da = 1.
            self.grad += 1.0 * out.grad
            other.grad += 1.0 * out.grad
        out._backward = _backward
    
        return out
    
    # Multiplication: c = a * b
    def __mul__(self, other):
        other = other if isinstance(other, Value) else Value(other)
        out = Value(self.data * other.data, (self, other), '*')
    
        def _backward():
            # Chain rule: dL/da = dL/dc * dc/da. For multiplication, dc/da = b.
            self.grad += other.data * out.grad
            other.grad += self.data * out.grad
        out._backward = _backward
    
        return out
    
    # Power: c = a^n
    def __pow__(self, other):
        assert isinstance(other, (int, float)), "Supporting only int/float powers"
        out = Value(self.data**other, (self,), f'^{other}')
    
        def _backward():
            # Power rule: d(x^n)/dx = n * x^(n-1)
            self.grad += (other * (self.data**(other-1))) * out.grad
        out._backward = _backward
    
        return out
    
    def relu(self):
        out = Value(0 if self.data < 0 else self.data, (self,), 'ReLU')
    
        def _backward():
            self.grad += (1.0 if out.data > 0 else 0) * out.grad
        out._backward = _backward
        return out
    
    def backward(self):
        """Topological sort to ensure we compute gradients in the right order."""
        topo = []
        visited = set()
        def build_topo(v):
            if v not in visited:
                visited.add(v)
                for child in v._prev:
                    build_topo(child)
                topo.append(v)
    
        build_topo(self)
    
        # Initial gradient is 1 (dOut/dOut)
        self.grad = 1.0
        for node in reversed(topo):
            node._backward()
    
    # Boilerplate for operator overloading
    def __neg__(self): return self * -1
    def __sub__(self, other): return self + (-other)
    def __rmul__(self, other): return self * other
    def __truediv__(self, other): return self * (other**-1)

    Step 2: Testing the Engine

    Let’s see if we can calculate the gradient of a simple function: $f(x, y) = (x \cdot y) + y^2$.

    python x = Value(2.0) y = Value(3.0)

    f = (x * y) + y^2

    f = (2 * 3) + 3^2 = 6 + 9 = 15

    f = (x * y) + (y ** 2)

    f.backward()

    print(f”Result: {f.data}”) # Should be 15.0 print(f”df/dx: {x.grad}”) # df/dx = y = 3.0 print(f”df/dy: {y.grad}”) # df/dy = x + 2y = 2 + 6 = 8.0


    Step 3: Minimal Neural Network Logic

    Now that we have the autograd engine, we can build a Neuron and Layer.

    python import random

    class Neuron: def init(self, nin): self.w = [Value(random.uniform(-1, 1)) for _ in range(nin)] self.b = Value(random.uniform(-1, 1))

    def __call__(self, x):
        # w * x + b
        act = sum((wi*xi for wi, xi in zip(self.w, x)), self.b)
        return act.relu()
    
    def parameters(self):
        return self.w + [self.b]

    Example Usage

    n = Neuron(2) x = [Value(1.0), Value(-2.0)] y = n(x) y.backward()

    print(f”Neuron Output: {y.data}”) print(f”Gradient of first weight: {n.w[0].grad}”)


    Key Takeaways for Your Implementation

    1. Gradient Accumulation (+=): We use += for self.grad because if a variable is used multiple times in a graph, its gradients must be summed (the Multivariate Chain Rule).
    2. Topological Sort: In the backward() method, you cannot calculate a node’s gradient until you have processed all nodes that depend on it. A topological sort ensures we move from the output back to the inputs correctly.
    3. Operator Overloading: Overloading __add__ and __mul__ allows you to write natural Python math code (a + b) while the Value class secretly builds the graph in the background.
    4. Zero Grad: In a real training loop, you must call grad = 0 between iterations, otherwise gradients from the previous step will keep adding to the new ones.

    This architecture is the fundamental “DNA” of PyTorch’s Variable and Function classes, scaled up to handle N-dimensional tensors and GPU acceleration.

    آخر تحديث25 فبراير 2026 - 10:04صفيأخبار مصر
  • 50 ألف جنيه غرام تصدم المعلم رشاد بقرار مفاجئ في

    50 ألف جنيه.. غرام تصدم المعلم رشاد بقرار مفاجئ في مسلسل مناعة

    آخر تحديث25 فبراير 2026 - 9:57صفيأخبار مصر
  • بشرى لمرضى القولون فوائد مذهلة لتناول الزبادي في السحور تقضي

    بشرى لمرضى القولون.. فوائد مذهلة لتناول الزبادي في السحور تقضي على الالتهابات وتحسن الهضم وظائف الجسم وفقًا لعميد معهد القلب الأسبق

    آخر تحديث25 فبراير 2026 - 9:44صفيأخبار مصر
  • نظام غذائي متكامل روشتة طبية لعلاج متاعب الجهاز الهضمي خلال

    نظام غذائي متكامل.. روشتة طبية لعلاج متاعب الجهاز الهضمي خلال شهر رمضان

    آخر تحديث25 فبراير 2026 - 9:36صفيأخبار مصر
  • صراع داليا ومصطفى هل تسترد بطلة مسلسل كان ياما كان

    صراع داليا ومصطفى.. هل تسترد بطلة مسلسل كان ياما كان سيارتها في الحلقة 8؟

    آخر تحديث25 فبراير 2026 - 9:33صفيأخبار مصر
  • جولة تفقدية رئيس الوزراء يتابع مشروع تطوير الطريق الدائري وصيانة

    جولة تفقدية.. رئيس الوزراء يتابع مشروع تطوير الطريق الدائري وصيانة كوبري 6 أكتوبر

    آخر تحديث25 فبراير 2026 - 9:27صفيأخبار مصر
  • دراما الواقع كيف وصفت الصحافة الفلسطينية دور مسلسل صحاب الأرض

    دراما الواقع.. كيف وصفت الصحافة الفلسطينية دور مسلسل صحاب الأرض في حماية الحقيقة؟

    آخر تحديث25 فبراير 2026 - 9:19صفيأخبار مصر
  • كمال يغادر السجن أحداث الحلقة السابعة تشعل الصراع بينه وبين

    كمال يغادر السجن.. أحداث الحلقة السابعة تشعل الصراع بينه وبين المعلم رشاد

    آخر تحديث25 فبراير 2026 - 9:16صفيأخبار مصر
  • بشراكة رسمية تسليم 42 مدفناً صحياً آمناً في محافظات مصرية

    بشراكة رسمية.. تسليم 42 مدفناً صحياً آمناً في محافظات مصرية مختلفة

    آخر تحديث25 فبراير 2026 - 9:13صفيأخبار مصر
  • سابع أيام رمضان موعد أذان المغرب وإقامة صلاة التراويح في

    سابع أيام رمضان.. موعد أذان المغرب وإقامة صلاة التراويح في القاهرة والمحافظات

    آخر تحديث25 فبراير 2026 - 9:07صفيأخبار مصر
  • قمة القاهرة تحضيرات دولية واسعة لمؤتمر دعم الجيش وقوى الأمن

    قمة القاهرة.. تحضيرات دولية واسعة لمؤتمر دعم الجيش وقوى الأمن اللبنانية

    آخر تحديث25 فبراير 2026 - 9:00صفيأخبار مصر
  • تحذير الأرصاد رياح باردة وأمطار تضرب عدة محافظات مع عودة

    تحذير الأرصاد.. رياح باردة وأمطار تضرب عدة محافظات مع عودة الأجواء الشتوية ونقص الحرارة

    آخر تحديث25 فبراير 2026 - 8:58صفيأخبار مصر
  • مواعيد جديدة تفاصيل تشغيل نفق الأزهر خلال يومي الخميس والجمعة

    مواعيد جديدة.. تفاصيل تشغيل نفق الأزهر خلال يومي الخميس والجمعة في رمضان

    آخر تحديث25 فبراير 2026 - 8:55صفيأخبار مصر
  • أسرار صباح تنكشف ماذا تخبئ الحلقة الثامنة من مسلسل حد

    أسرار صباح تنكشف.. ماذا تخبئ الحلقة الثامنة من مسلسل حد أقصى؟

    آخر تحديث25 فبراير 2026 - 8:52صفيأخبار مصر
  • انخفاض كبير بالحرارة الأرصاد تحدد ملامح طقس الأيام المقبلة حتى

    انخفاض كبير بالحرارة.. الأرصاد تحدد ملامح طقس الأيام المقبلة حتى الأحد الأخير من 2025

    آخر تحديث25 فبراير 2026 - 8:47صفيأخبار مصر
  • خطط استثمارية جديدة رئيس الوزراء يتابع مشروعات وزارة البترول في

    خطط استثمارية جديدة.. رئيس الوزراء يتابع مشروعات وزارة البترول في مصر المستهدفة قريباً

    آخر تحديث25 فبراير 2026 - 8:41صفيأخبار مصر
  • مصير فدوى هل ينجح عصام السقا في إنقاذها بمسلسل صحاب

    مصير فدوى.. هل ينجح عصام السقا في إنقاذها بمسلسل صحاب الأرض الحلقة 8؟

    آخر تحديث25 فبراير 2026 - 8:36صفيأخبار مصر
  • شبورة مائية كثيفة خريطة درجات الحرارة المتوقعة في القاهرة والمحافظات

    شبورة مائية كثيفة.. خريطة درجات الحرارة المتوقعة في القاهرة والمحافظات غدًا

    آخر تحديث25 فبراير 2026 - 8:30صفيأخبار مصر
  • أحداث مشتعلة هل تنجح طليقة ياسر جلال في إفساد زفافه

    أحداث مشتعلة.. هل تنجح طليقة ياسر جلال في إفساد زفافه بالحلقة الثامنة؟

    آخر تحديث25 فبراير 2026 - 8:25صفيأخبار مصر
  • رسميًا 7 ملايين سلة غذائية انطلاق مبادرة أبواب الخير في

    رسميًا 7 ملايين سلة غذائية.. انطلاق مبادرة أبواب الخير في رمضان 2025 | تعرف على التفاصيل بالإنفوجراف

    آخر تحديث25 فبراير 2026 - 8:22صفيأخبار مصر
  • أرض لا ترحل حكاية صمود مصرية منعت تغيير خريطة الصراع

    أرض لا ترحل.. حكاية صمود مصرية منعت تغيير خريطة الصراع في المنطقة

    آخر تحديث25 فبراير 2026 - 8:20صفيأخبار مصر
صفحات:
عرض المزيد
« الصفحة السابقة 1 … 9 10 11 12 13 … 18 التالي »
مواقع التواصلفيسبوكمنصة إكس
  • اتصل بنا
  • إمساكية رمضان 2026
  • مسلسلات رمضان 2026
  • حظك اليوم – الأبراج
  • مواقيت الصلاة اليوم – مصر

جميع الحقوق محفوظة © جريدة مانشيت 2026

  • اتصل بنا
  • إمساكية رمضان 2026
  • مسلسلات رمضان 2026
  • حظك اليوم – الأبراج
  • مواقيت الصلاة اليوم – مصر

جميع الحقوق محفوظة © جريدة مانشيت 2026

تغيير الثيم
  • أخبار دوليّة
  • أخبار مصر
  • تجارة وأعمال
  • رياضة
  • تكنولوجيا
  • ترفيه
مواقع التواصلفيسبوكمنصة إكس
البحث عن: