Skip to content

Commit

Permalink
adding comment
Browse files Browse the repository at this point in the history
  • Loading branch information
drankincms committed Jun 21, 2022
1 parent 0a5d209 commit 5bddddf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hls4ml/model/optimizer/passes/multi_dense.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
class ReplaceMultidimensionalDenseWithConv(OptimizerPass):
def match(self, node):
return isinstance(node, Dense) and \
len(node.get_input_variable().shape) - sum(d==1 for d in node.get_input_variable().shape) > 1
len(node.get_input_variable().shape) - sum(d==1 for d in node.get_input_variable().shape) > 1
# The above sum checks for the number of dimensions in the Dense with size 1
# The subtraction allows the check to only count the number of dimensions with non-1 size
# For example, this prevents matching for a Dense layer with shape (1,N)

def transform(self, model, node):
dim = len(node.get_input_variable().shape) - 1
Expand Down

0 comments on commit 5bddddf

Please sign in to comment.