Add comment about the DeviceWrapper class since TF 1.1
parent
b9b6066438
commit
37eb9b4148
|
@ -1390,23 +1390,7 @@
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"Alternatively, you can use the Tensorflow class DeviceWrapper - note you can define more than one layer per gpu"
|
"Alternatively, since TensorFlow 1.1, you can use the `tf.contrib.rnn.DeviceWrapper` class (alias `tf.nn.rnn_cell.DeviceWrapper` since TF 1.2)."
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"devices = [\"/gpu:0\", \"/gpu:1\", \"/gpu:2\"] \n",
|
|
||||||
"cells = []\n",
|
|
||||||
"for dev in devices:\n",
|
|
||||||
" cell = DeviceWrapper(rnn_cell.BasicRNNCell(num_units=n_neurons), dev)\n",
|
|
||||||
" cells.append(cell)\n",
|
|
||||||
"\n",
|
|
||||||
"self.multiple_lstm_cells = tf.contrib.rnn.MultiRNNCell(cells, state_is_tuple=True)\n",
|
|
||||||
"outputs, states = tf.nn.dynamic_rnn(multi_layer_cell, X, dtype=tf.float32)"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -2722,21 +2706,21 @@
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
"name": "ipython",
|
"name": "ipython",
|
||||||
"version": 3.0
|
"version": 3
|
||||||
},
|
},
|
||||||
"file_extension": ".py",
|
"file_extension": ".py",
|
||||||
"mimetype": "text/x-python",
|
"mimetype": "text/x-python",
|
||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.5.2"
|
"version": "3.6.2"
|
||||||
},
|
},
|
||||||
"nav_menu": {},
|
"nav_menu": {},
|
||||||
"toc": {
|
"toc": {
|
||||||
"navigate_menu": true,
|
"navigate_menu": true,
|
||||||
"number_sections": true,
|
"number_sections": true,
|
||||||
"sideBar": true,
|
"sideBar": true,
|
||||||
"threshold": 6.0,
|
"threshold": 6,
|
||||||
"toc_cell": false,
|
"toc_cell": false,
|
||||||
"toc_section_display": "block",
|
"toc_section_display": "block",
|
||||||
"toc_window_display": false
|
"toc_window_display": false
|
||||||
|
|
Loading…
Reference in New Issue