Код: Выделить всё
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()
Всего параметров: 0 (0,00 Б)
Обучаемые параметры: 0 (0,00 Б)
Необучаемые параметры: 0 (0,00 Б) )
Подробнее здесь: https://stackoverflow.com/questions/792 ... -are-empty
Мобильная версия