Here is sample code:
from abc import *
class weightlayer(metaclass=ABCMeta):
def __init_subclass__(cls):
cls.count = 0
def __init__(self):
self.order = cls.count
cls.count += 1
@abstractmethod
def init_weight(self):
pass
class A_layer(weightlayer):
def init_weight(self):
pass
class B_layer(weightlayer):
def init_weight(self):
pass
I already searched it many times but I can't find the solution.
My idea doesn't work because __ init __
function doesn't have the cls
parameter.
What should I do?