Skip to content

Commit

Permalink
Fix not throwing verbose error when a layer is unsupported
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane committed Feb 25, 2021
1 parent b010dc4 commit 0c6dbf9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions konverter/utils/konverter_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ def get_class_from_name(self, name, search_in):
"""
:param name: A name of an attribute, ex. keras.layers.Dense, keras.activations.relu
:param search_in: A class list to search, ex. 'layers', 'models'
:return: A class object of the attribute name, or False if not found/supported
:return: A class object of the attribute name, or an empty Unsupported class if not found/supported
"""
attrs = getattr(self, search_in, None)
for attr_class in attrs:
if name == attr_class.name:
return attr_class() # new instance of class
if search_in == 'activations': # not found
base = Activations.Unsupported()
base.name = name
return base
return False
# Not found, unsupported. This code finds the type of class we're looking for and creates a new instance of its Unsupported sub-class
# For example if search_in is 'activations' then it returns Activations.Unsupported()
base = globals()[search_in.title()].Unsupported()
base.name = name
return base

def in_models(self, name):
return name in [mdl.name for mdl in self.models]
Expand Down

0 comments on commit 0c6dbf9

Please sign in to comment.