old_contents: import tensorflow as tf
  
  class DeviceCellWrapper(tf.contrib.rnn.RNNCell):
      def __init__(self, device, cell):
          self._cell = cell
          self._device = device
  
      @property
      def state_size(self):
          return self._cell.state_size
      
      @ property
      def output_size(self):
          return self._cell.output_size
      
      def __call__(self, inputs, state, scope=None):
          with tf.device(self._device):
              return self._cell(inputs, state, scope)
      
  devices = ["/gpu:0", "/gpu:1", "/gpu:2"]
  cells = [DeviceCellWrapper(dev, tf.contrib.rnn.BasicRNNCell(num_units=n_neurons))
      for dev in devices]
  multi_layer_cell = tf.contrib.rnn.MultiRNNCell(cells)
  outputs, states = tf.nn.dynamic_rnn(multi_layer_cell, X, dtype=tf.float32)
new_contents: # Class for TF distributed deep RNN
  
  import tensorflow as tf
  
  class DeviceCellWrapper(tf.contrib.rnn.RNNCell):
      def __init__(self, device, cell):
          self._cell = cell
          self._device = device
  
      @property
      def state_size(self):
          return self._cell.state_size
      
      @ property
      def output_size(self):
          return self._cell.output_size
      
      def __call__(self, inputs, state, scope=None):
          with tf.device(self._device):
              return self._cell(inputs, state, scope)
      
  devices = ["/gpu:0", "/gpu:1", "/gpu:2"]
  cells = [DeviceCellWrapper(dev, tf.contrib.rnn.BasicRNNCell(num_units=n_neurons))
      for dev in devices]
  multi_layer_cell = tf.contrib.rnn.MultiRNNCell(cells)
  outputs, states = tf.nn.dynamic_rnn(multi_layer_cell, X, dtype=tf.float32)
subject: Add comments