Skip to content

Commit

Permalink
fix accum_t; no transpose for resource?
Browse files Browse the repository at this point in the history
  • Loading branch information
jmduarte committed Mar 18, 2023
1 parent ba89ef8 commit 970ee1c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions hls4ml/backends/fpga/fpga_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
Activation,
BatchNormalization,
Conv1D,
Conv1DTranspose,
Conv2D,
Conv2DTranspose,
Dense,
Dot,
Embedding,
Expand Down Expand Up @@ -52,7 +54,9 @@ def __init__(self, name):
accum_layers = [
Dense,
Conv1D,
Conv1DTranspose,
Conv2D,
Conv2DTranspose,
SeparableConv1D,
SeparableConv2D,
Pooling1D,
Expand Down
5 changes: 2 additions & 3 deletions hls4ml/backends/vivado/passes/resource_strategy.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import numpy as np

from hls4ml.model.optimizer import OptimizerPass
from hls4ml.model.layers import Conv1D, Conv2D, Conv1DTranspose, Conv2DTranspose, Dense, SeparableConv1D, SeparableConv2D, LSTM, GRU
from hls4ml.model.layers import Conv1D, Conv2D, Dense, SeparableConv1D, SeparableConv2D, LSTM, GRU

class ApplyResourceStrategy(OptimizerPass):
''' Transposes the weights to use the dense_resource matrix multiply routine '''
def match(self, node):

node_matches = isinstance(node, (Dense, Conv1D, SeparableConv1D, Conv2D, SeparableConv2D, LSTM, GRU, Conv1DTranspose, Conv2DTranspose))

node_matches = isinstance(node, (Dense, Conv1D, SeparableConv1D, Conv2D, SeparableConv2D, LSTM, GRU))
is_resource_strategy = node.get_attr('strategy', '').lower() == 'resource'
already_transformed = node.get_attr('_weights_transposed', False) == True

Expand Down

0 comments on commit 970ee1c

Please sign in to comment.