fixed bug: model.__str__ crashed when there is a Sigmoid/Tanh or a nn.Sequential with no layers in custom model

This commit is contained in:
vealocia 2020-03-29 19:14:26 +08:00
parent c81a8ed4b6
commit 2d0e92507a
1 changed files with 2 additions and 0 deletions

View File

@ -506,6 +506,8 @@ class Module:
return cd
def extra_repr(self):
if self.__init__.__defaults__ is None:
return ""
ss = []
n = len(self.__init__.__code__.co_varnames) - \
len(self.__init__.__defaults__)