What is the use of @nn.compact in FLAX?
class Net(nn.Module):
@nn.compact
def __call__(self, x):
self.n = 1
return x
The same can be done by using :
class Net(nn.Module):
def setup(self):
self.n = 1
def __call__(self, x):
return x
What is the use of the decorative @nn.compact using explicitly in the code?