class_docstr: An subclass of the NeuralStackCell which reads/writes in both directions.
  
  See section 3.3 of Grefenstette et al., 2015.
class_docstr_tok: ["An","subclass","of","the","NeuralStackCell","which","reads\/writes","in","both","directions",".","See","section","3.3","of","Grefenstette","et","al.",",","2015","."]
docstr: Initialize write strengths which write in both directions.
  
  Unlike in Grefenstette et al., It's writing out from the center of the
  memory so that it doesn't need to shift the entire memory forward at each
  step.
  
  Args:
    batch_size: The size of the current batch.
  
  Returns:
    A tf.float32 tensor of shape [num_write_heads, memory_size, 1].
docstr_tok: ["Initialize","write","strengths","which","write","in","both","directions",".","Unlike","in","Grefenstette","et","al.",",","It","'s","writing","out","from","the","center","of","the","memory","so","that","it","does","n't","need","to","shift","the","entire","memory","forward","at","each","step",".","Args",":","batch_size",":","The","size","of","the","current","batch",".","Returns",":","A","tf.float32","tensor","of","shape","[","num_write_heads",",","memory_size",",","1","]","."]
code: def initialize_write_strengths(self, batch_size):
      """Initialize write strengths which write in both directions.
  
      Unlike in Grefenstette et al., It's writing out from the center of the
      memory so that it doesn't need to shift the entire memory forward at each
      step.
  
      Args:
        batch_size: The size of the current batch.
  
      Returns:
        A tf.float32 tensor of shape [num_write_heads, memory_size, 1].
      """
      memory_center = self._memory_size // 2
      return tf.expand_dims(
          tf.concat(
              [
                  # The write strength for the deque bottom.
                  # Should be shifted back at each timestep.
                  tf.one_hot(
                      [[memory_center - 1]] * batch_size,
                      depth=self._memory_size,
                      dtype=tf.float32,
                  ),
                  # The write strength for the deque top.
                  # Should be shifted forward at each timestep.
                  tf.one_hot(
                      [[memory_center]] * batch_size,
                      depth=self._memory_size,
                      dtype=tf.float32,
                  ),
              ],
              axis=1,
          ),
          axis=3,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from tensor2tensor.layers import common_hparams
  from tensor2tensor.layers import common_layers
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import t2t_model
  import tensorflow.compat.v1
label_desc: Use image node_id 4 for calling the NeuralDequeCell obj's underlying member method code with example usage: obj.initialize_write_strengths(batch_size) and returns: tf