declearn.model.tensorflow.utils.move_layer_to_device
Create a copy of an input keras layer placed on a given device.
This functions creates a copy of the input layer and of all its weights. It may therefore be costful and should be used sparingly, to move away variables on a device where all further computations are expected to be run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer |
tf_keras.layers.Layer
|
Keras layer that needs moving to another device. |
required |
device |
Union[tf.config.LogicalDevice, str]
|
Device where to place the layer's weights. |
required |
Returns:
Name | Type | Description |
---|---|---|
layer |
tf_keras.layers.Layer
|
Copy of the input layer, with its weights backed on |
Source code in declearn/model/tensorflow/utils/_gpu.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|