《TensorFlow 2项目进阶实战》2-快速上手篇:动⼿训练模型和部署服务## 目录 - TensorFlow 2 开发环境搭建 - 使用 tf.keras.datasets 加载数据 - 使用 tf.data.Dataset 加载数据 - 使用 tf.keras.Model 管理模型 - Fashion MNIST 数据集介绍 - 使用 TensorFlow 2 训练分类网络 TensorFlow 2 开发环境搭建 ## TensorFlow 2 支持的操作系统 Tools细胞数据 细胞数据 细胞数据 ## Try it! 使用 tf.keras.Model 管理模型 #### 历史上的 tf.keras.Model • Class tf.compat.v1.keras.Model • Class tf.compat.v1.keras.models.Model • v2.keras.Model • Class tf.compat.v2.keras.models.Model • Class tf.keras.models.Model #### 使用 tf.keras.Model 构建模型 ## 构建CNN模型网络(Sequential) In [3]: model = tf.keras.models.Sequential([ tf.keras.layers 0 码力 | 52 页 | 7.99 MB | 2 年前3
《Efficient Deep Learning Book》[EDL] Chapter 4 - Efficient Architectureskeras.layers.Dense(num_classes, activation='softmax')(x) output = x model = tf.keras.Model(int_sequences_input, output, name='bow') model.summary() return model # Train x = layers.Dropout(0.5)(x) preds = layers.Dense(14, activation="softmax")(x) model = tf.keras.Model(int_sequences_input, preds) model.summary() return model We can train this model with and without dtype='string') x = vectorization_layer(string_input) predictions = cnn_model_w2v(x) end_to_end_model = tf.keras.Model(string_input, predictions) We can now classify a new piece of text, and map it to a class name0 码力 | 53 页 | 3.92 MB | 2 年前3
《Efficient Deep Learning Book》[EDL] Chapter 7 - Automationlayers.Dense(DATASET_PARAMS['n_classes'], activation='softmax') (x) model = tf.keras.Model(inp, output) optimizer = optimizers.Adam(learning_rate=CHILD_PARAMS['learning_rate']) pred_action = prediction_layer(prev_output) predictions.append(pred_action) model = tf.keras.Model(inputs=start_state, outputs=predictions) model.summary() return model def predict_child(self0 码力 | 33 页 | 2.48 MB | 2 年前3
《Efficient Deep Learning Book》[EDL] Chapter 6 - Advanced Learning Techniques - Technical Reviewactivation=None)(output) output = tf.keras.layers.Activation('softmax')(output) bert_classifier = tf.keras.Model(bert_inputs, output) bert_classifier.compile( optimizer=tf.keras.optimizers.Adam(learning_rate)0 码力 | 31 页 | 4.03 MB | 2 年前3
《Efficient Deep Learning Book》[EDL] Chapter 3 - Learning TechniquesThis model will be used as the teacher, to extract the logits. model_wm_10_without_softmax = tf.keras.Model( inputs=model_wm_10.inputs, outputs=model_wm_10.layers[-2].output) model_wm_10_without_softmax0 码力 | 56 页 | 18.93 MB | 2 年前3
共 5 条
- 1













