[Python] Why model parameters are empty?

Discussão em 'Python' iniciado por Stack, Dezembro 17, 2024.

  1. Stack

    Stack Membro Participativo

    import numpy as np
    import tensorflow as tp

    # Importing imdb dataset
    from tensorflow.keras.datasets import imdb
    from tensorflow.keras.preprocessing import sequence
    # The sequence module in tensorflow.keras.preprocessing provides utilities for preprocessing sequence data, such as text or time-series data.

    from tensorflow.keras.models import Sequential
    # The sequence module in tensorflow.keras.preprocessing provides utilities for preprocessing sequence data, such as text or time-series data.

    from tensorflow.keras.layers import Embedding, SimpleRNN, Dense

    # Define the model
    model = Sequential()

    # Add the Embedding layer
    model.add(Embedding(1000, 128)) # Adjust the vocabulary size (1000) as needed

    # Print the summary of the model to check the parameters
    model.summary()

    # Add the SimpleRNN layer
    model.add(SimpleRNN(128, activation='relu'))

    # Add the Dense output layer
    model.add(Dense(1, activation='sigmoid'))

    # Print the model layers
    print(model.layers)

    # Print the summary to check the parameters
    model.summary()


    I am trying to create a model using simpleRNN. What is the issue here? I get trainable params as 0:

    Total params: 0 (0.00 B)
    Trainable params: 0 (0.00 B)
    Non-trainable params: 0 (0.00 B)

    Continue reading...

Compartilhe esta Página