💡 Class : OOP에서 구현하려는 개념을 추상화한 코드 템플릿.
# Python Class example
class Human(superclass): # 상속을 받고 싶을 때, 상속받을 클래스 이름을 파라미터로 지정.
def __init__(self, name, weight): # Constructor
self.name = name
self.weight = weight
...
def gain_weight(self, a, b):
tmp_weight = self.weight + a
<statement>
...
return tmp_weight
>>> object1 = Human("Kim", 70) # class_name() : __init__ method call
>>> object1.name
>>> "Kim"
>>> object1.gain_weight(5, 7)
>>> 75
__init__()
함수를 이용하여 구현합니다.self
라는 자체 변수를 가집니다. self는 말 그대로 객체(class) 자기 자신을 지칭합니다.Tensorflow/Keras template
https://github.com/Husseinjd/keras-tensorflow-template
Pytorch template
https://github.com/victoresque/pytorch-template