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

A question on the number of parameter #8

Open
who7384 opened this issue Feb 23, 2022 · 0 comments
Open

A question on the number of parameter #8

who7384 opened this issue Feb 23, 2022 · 0 comments

Comments

@who7384
Copy link

who7384 commented Feb 23, 2022

Hi Akara,

Thanks for your excellent project! But I am confused about the number of parameters. The paper said the parameter number is about 1.3M, but when I added some extra code to calculate parameter numbers, such as:

num_params = 0
        for variable in tf.trainable_variables():
            shape = variable.get_shape()
            num_params += reduce(mul, [dim.value for dim in shape], 1)
print(num_params)

The output was:

cnn/conv1d_1/conv2d/kernel:0 6400
cnn/bn_1/batch_normalization/gamma:0 128
cnn/bn_1/batch_normalization/beta:0 128
cnn/conv1d_2_1/conv2d/kernel:0 131072
cnn/bn_2_1/batch_normalization/gamma:0 128
cnn/bn_2_1/batch_normalization/beta:0 128
cnn/conv1d_2_2/conv2d/kernel:0 131072
cnn/bn_2_2/batch_normalization/gamma:0 128
cnn/bn_2_2/batch_normalization/beta:0 128
cnn/conv1d_2_3/conv2d/kernel:0 131072
cnn/bn_2_3/batch_normalization/gamma:0 128
cnn/bn_2_3/batch_normalization/beta:0 128
rnn/rnn/multi_rnn_cell/cell_0/lstm_cell/kernel:0 1114112
rnn/rnn/multi_rnn_cell/cell_0/lstm_cell/bias:0 512
rnn/rnn/multi_rnn_cell/cell_0/lstm_cell/w_f_diag:0 128
rnn/rnn/multi_rnn_cell/cell_0/lstm_cell/w_i_diag:0 128
rnn/rnn/multi_rnn_cell/cell_0/lstm_cell/w_o_diag:0 128
1515648

Would you please tell me why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant