Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix profiling for Keras LSTM layers. #940

Merged
merged 2 commits into from
Dec 15, 2023
Merged

Conversation

Landay7
Copy link
Contributor

@Landay7 Landay7 commented Dec 10, 2023

Description

Before it for Keras LSTM it throws IndexError: list index out of range.
I know, that there is a low chance that it will be run without the HLS model, but still would be good to set properly.

Type of change

  • Bug fix (non-breaking change that fixes an issue)

Tests

import hls4ml
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Conv1D, Activation, MaxPooling1D, LSTM, Dense, Input

input = Input(shape = (600, 10 ), name = 'input')
    
x = Conv1D(
    filters = 4,
    kernel_size = 3,
    strides = 1,
    padding = 'valid',
    name = 'conv_1',
)(input)

x = Activation(
    'relu',
    name = 'conv_act_1'
)(x)
x = MaxPooling1D(
    pool_size = 3,
    padding = 'valid',
    name = 'pool_1'
)(x)
x = LSTM(16, name = 'lstm')(x)
x = Dense(10, name = 'dense')(x)

model = Model(inputs = input, outputs = x)
hls4ml.model.profiling.numerical(model = model, hls_model = None)

Checklist

  • I have read the guidelines for contributing.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have installed and run pre-commit on the files I edited or added.
  • I have added tests that prove my fix is effective or that my feature works.

@jmitrevs jmitrevs added the please test Trigger testing by creating local PR branch label Dec 14, 2023
@jmitrevs jmitrevs added this to the v0.8.1 milestone Dec 15, 2023
@jmitrevs jmitrevs merged commit 77ca9c0 into fastmachinelearning:main Dec 15, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
please test Trigger testing by creating local PR branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants