tensorflow(十九):全连接层
一、全连接层
二、实战
import tensorflow as tf from tensorflow import keras import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' x = tf.random.normal([2,3]) model = keras.Sequential([ keras.layers.Dense(2, activation='relu'), keras.layers.Dense(2, activation='relu'), keras.layers.Dense(2) ]) model.build(input_shape=[None, 3]) model.summary() for p in model.trainable_variables: print(p.name,p.shape)
补全:
from tenorflow.python import keras #代替下面的
from tensorflow import keras #代码补全功能就非常好用了。