(layers,
          training,
          inputs_BxIxD,
          bias_BxIxI,
          memory_BxMxD,
          bias_BxIxM,
          cache=None,
          decode_i=None)
return s_BxIxD
Stack AttentionBlock layers.
Stack AttentionBlock layers.
Stack AttentionBlock layers .
def stack(layers,
          training,
          inputs_BxIxD,
          bias_BxIxI,
          memory_BxMxD,
          bias_BxIxM,
          cache=None,
          decode_i=None):
  """Stack AttentionBlock layers."""
  if (memory_BxMxD is None) != (bias_BxIxM is None):
    raise ValueError("memory and memory_bias need to be provided together.")
  s_BxIxD = inputs_BxIxD
  for i, layer in enumerate(layers):
    with tf.variable_scope("layer_%d" % i):
      s_BxIxD = layer(
          training,
          s_BxIxD,
          bias_BxIxI,
          memory_BxMxD,
          bias_BxIxM,
          cache=cache[str(i)] if cache is not None else None,
          decode_i=decode_i)
  return s_BxIxD
def stack ( layers , training , inputs_BxIxD , bias_BxIxI , memory_BxMxD , bias_BxIxM , cache = None , decode_i = None ) : if ( memory_BxMxD is None ) != ( bias_BxIxM is None ) : raise ValueError ( "memory and memory_bias need to be provided together." ) s_BxIxD = inputs_BxIxD for i , layer in enumerate ( layers ) : with tf . variable_scope ( "layer_%d" % i ) : s_BxIxD = layer ( training , s_BxIxD , bias_BxIxI , memory_BxMxD , bias_BxIxM , cache = cache [ str ( i ) ] if cache is not None else None , decode_i = decode_i ) return s_BxIxD