Commit bbdc4ea2 authored by Bharath Ramsundar's avatar Bharath Ramsundar
Browse files

Partial debugging progress

parent 1b30f4d2
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -66,8 +66,6 @@ class Layer(object):
    if not hasattr(self, 'uses_learning_phase'):
      self.uses_learning_phase = False

    if not hasattr(self, '_non_trainable_weights'):
      self._non_trainable_weights = []
    if not hasattr(self, 'losses'):
      self.losses = []

@@ -133,8 +131,9 @@ class Layer(object):
    ----------
    x: Can be a tensor or list/tuple of tensors.
    """
    outputs = to_list(self.call(x))
    return outputs
    return self.call(x)
    #outputs = to_list(self.call(x))
    #return outputs

class InputLayer(Layer):
  """Layer to be used as an entry point into a graph.
@@ -154,7 +153,6 @@ class InputLayer(Layer):
               input_dtype=None, name=None):
    self.uses_learning_phase = False
    self.trainable = False
    self._non_trainable_weights = []

    if not name:
      prefix = 'input'
+14 −13
Original line number Diff line number Diff line
@@ -488,19 +488,6 @@ class AttnLSTMEmbedding(Layer):
    self.n_test = n_test
    self.n_support = n_support

  def build(self, input_shape):
    """Initializes trainable weights."""
    x_input_shape, xp_input_shape = input_shape  #Unpack

    n_feat = xp_input_shape[1]

    self.lstm = LSTMStep(n_feat)
    self.q_init = model_ops.zeros([self.n_test, n_feat])
    self.r_init = model_ops.zeros([self.n_test, n_feat])
    self.states_init = self.lstm.get_initial_states([self.n_test, n_feat])
    
    self.trainable_weights = [self.q_init, self.r_init]
      
  def get_output_shape_for(self, input_shape):
    """Returns the output shape. Same as input_shape.

@@ -538,6 +525,20 @@ class AttnLSTMEmbedding(Layer):
    # x is test set, xp is support set.
    x, xp = x_xp

    ## Initializes trainable weights.
    #n_feat = xp_input_shape[1]
    n_feat = xp.get_shape()[1]

    self.lstm = LSTMStep(n_feat)
    self.q_init = model_ops.zeros([self.n_test, n_feat])
    self.r_init = model_ops.zeros([self.n_test, n_feat])
    self.states_init = self.lstm.get_initial_states([self.n_test, n_feat])
    
    self.trainable_weights = [self.q_init, self.r_init]


    ### Performs computations

    # Get initializations
    q = self.q_init
    #r = self.r_init      
+4 −0
Original line number Diff line number Diff line
@@ -69,6 +69,10 @@ class TestLayers(test_util.TensorFlowTestCase):

      X = graph_topology.get_input_placeholders()
      out = graph_gather_layer(X)
      ##################################################### DEBUG
      print("out")
      print(out)
      ##################################################### DEBUG
      # Output should be of shape (batch_size, n_feat)
      assert out.get_shape() == (batch_size, n_feat)