Step01-Variable
The final goal of "Deep Learning from Scratch 3" is to implement "DeZero", which is the original framework of this book. For achieving this goal, we will start from the very basis of DeZero.
The first step of this project is to make a "Variable". I am pretty sure that all CS majors are familiar with this notion. We are implementing a class that will play the role of a variable. Class Variable will look like this:
class Variable:
def __init__(self, data):
self.data=data
So, the class Variable will be a "box", which is going to contain data.
import numpy as np
data=np.array(1.0)
x=Variable(data)
print(x.data)
For example, the result of the code above is "1.0". This means the box "x" is containing an array that has "1.0" as an element.
From now, we can assign new data in x.data, like x.data=np.array(2.0).
댓글
댓글 쓰기