(x, n_inputs, n_outputs, name, filter_length, rate,
                  batch_size)
return y, (init_1, init_2), (push_1, push_2)
Applies dilated convolution using queues.

  Assumes a filter_length of 3.

  Args:
    x: The [mb, time, channels] tensor input.
    n_inputs: The input number of channels.
    n_outputs: The output number of channels.
    name: The variable scope to provide to W and biases.
    filter_length: The length of the convolution, assumed to be 3.
    rate: The rate or dilation
    batch_size: Non-symbolic value for batch_size.

  Returns:
    y: The output of the operation
    (init_1, init_2): Initialization operations for the queues
    (push_1, push_2): Push operations for the queues
Applies dilated convolution using queues.
Applies dilated convolution using queues .
def causal_linear(x, n_inputs, n_outputs, name, filter_length, rate,
                  batch_size):
  """Applies dilated convolution using queues.

  Assumes a filter_length of 3.

  Args:
    x: The [mb, time, channels] tensor input.
    n_inputs: The input number of channels.
    n_outputs: The output number of channels.
    name: The variable scope to provide to W and biases.
    filter_length: The length of the convolution, assumed to be 3.
    rate: The rate or dilation
    batch_size: Non-symbolic value for batch_size.

  Returns:
    y: The output of the operation
    (init_1, init_2): Initialization operations for the queues
    (push_1, push_2): Push operations for the queues
  """
  assert filter_length == 3

  # create queue
  q_1 = tf.FIFOQueue(rate, dtypes=tf.float32, shapes=(batch_size, 1, n_inputs))
  q_2 = tf.FIFOQueue(rate, dtypes=tf.float32, shapes=(batch_size, 1, n_inputs))
  init_1 = q_1.enqueue_many(tf.zeros((rate, batch_size, 1, n_inputs)))
  init_2 = q_2.enqueue_many(tf.zeros((rate, batch_size, 1, n_inputs)))
  state_1 = q_1.dequeue()
  push_1 = q_1.enqueue(x)
  state_2 = q_2.dequeue()
  push_2 = q_2.enqueue(state_1)

  # get pretrained weights
  w = tf.get_variable(
      name=name + "/W",
      shape=[1, filter_length, n_inputs, n_outputs],
      dtype=tf.float32)
  b = tf.get_variable(
      name=name + "/biases", shape=[n_outputs], dtype=tf.float32)
  w_q_2 = tf.slice(w, [0, 0, 0, 0], [-1, 1, -1, -1])
  w_q_1 = tf.slice(w, [0, 1, 0, 0], [-1, 1, -1, -1])
  w_x = tf.slice(w, [0, 2, 0, 0], [-1, 1, -1, -1])

  # perform op w/ cached states
  y = tf.nn.bias_add(
      tf.matmul(state_2[:, 0, :], w_q_2[0][0]) + tf.matmul(
          state_1[:, 0, :], w_q_1[0][0]) + tf.matmul(x[:, 0, :], w_x[0][0]), b)

  y = tf.expand_dims(y, 1)
  return y, (init_1, init_2), (push_1, push_2)
def causal_linear ( x , n_inputs , n_outputs , name , filter_length , rate , batch_size ) : assert filter_length == 3 # create queue q_1 = tf . FIFOQueue ( rate , dtypes = tf . float32 , shapes = ( batch_size , 1 , n_inputs ) ) q_2 = tf . FIFOQueue ( rate , dtypes = tf . float32 , shapes = ( batch_size , 1 , n_inputs ) ) init_1 = q_1 . enqueue_many ( tf . zeros ( ( rate , batch_size , 1 , n_inputs ) ) ) init_2 = q_2 . enqueue_many ( tf . zeros ( ( rate , batch_size , 1 , n_inputs ) ) ) state_1 = q_1 . dequeue ( ) push_1 = q_1 . enqueue ( x ) state_2 = q_2 . dequeue ( ) push_2 = q_2 . enqueue ( state_1 ) # get pretrained weights w = tf . get_variable ( name = name + "/W" , shape = [ 1 , filter_length , n_inputs , n_outputs ] , dtype = tf . float32 ) b = tf . get_variable ( name = name + "/biases" , shape = [ n_outputs ] , dtype = tf . float32 ) w_q_2 = tf . slice ( w , [ 0 , 0 , 0 , 0 ] , [ - 1 , 1 , - 1 , - 1 ] ) w_q_1 = tf . slice ( w , [ 0 , 1 , 0 , 0 ] , [ - 1 , 1 , - 1 , - 1 ] ) w_x = tf . slice ( w , [ 0 , 2 , 0 , 0 ] , [ - 1 , 1 , - 1 , - 1 ] ) # perform op w/ cached states y = tf . nn . bias_add ( tf . matmul ( state_2 [ : , 0 , : ] , w_q_2 [ 0 ] [ 0 ] ) + tf . matmul ( state_1 [ : , 0 , : ] , w_q_1 [ 0 ] [ 0 ] ) + tf . matmul ( x [ : , 0 , : ] , w_x [ 0 ] [ 0 ] ) , b ) y = tf . expand_dims ( y , 1 ) return y , ( init_1 , init_2 ) , ( push_1 , push_2 )