Build Deep Learning Framework:Step1 Variable

Post at — Feb 09, 2025
#Deep_Learning_Framework

How to Build Deep Learning Framework Step By Step Using 60 steps:Step1

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
import numpy as np

class Variable:
    def __init__(self, data):
        self.data = data

data = np.array(1.0)
x = Variable(data)
print(x.data)

x.data = np.array(2.0)
print(x.data)

The Class Variable likes a box to store the data, while the data is not only a number or called scalar,it can be a vector or an array also.