In [1]:
import sys
sys.path.append('../src/mane/prototype/')
import graph as g
import embeddings as e


Using Theano backend.

In [2]:
bc = g.graph_from_pickle('../src/mane/data/blogcatalog3.graph')

In [3]:
model = e.EmbeddingNet(graph=bc)

In [4]:
model.build()

In [5]:
model.train()


Epoch 1/1
355000/355000 [==============================] - 502s - loss: 0.7359   
Epoch 1/1
 15904/355000 [>.............................] - ETA: 569s - loss: 0.7476
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
/home/hoangnt/anaconda3/lib/python3.5/site-packages/theano/compile/function_module.py in __call__(self, *args, **kwargs)
    858         try:
--> 859             outputs = self.fn()
    860         except Exception:

IndexError: index 10312 is out of bounds for size 10312

During handling of the above exception, another exception occurred:

IndexError                                Traceback (most recent call last)
<ipython-input-5-22a9f6312119> in <module>()
----> 1 model.train()

/home/hoangnt/Dropbox/WorkingFiles/motifwalk/research/src/mane/prototype/embeddings.py in train(self, mode, batch_size, verbose)
    198                 shuffle = True
    199             self._model.fit([targets, classes], [labels],
--> 200                             nb_epoch=self._epoch, verbose=verbose)
    201 
    202     # init_normal

/home/hoangnt/anaconda3/lib/python3.5/site-packages/keras/engine/training.py in fit(self, x, y, batch_size, nb_epoch, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight)
   1105                               verbose=verbose, callbacks=callbacks,
   1106                               val_f=val_f, val_ins=val_ins, shuffle=shuffle,
-> 1107                               callback_metrics=callback_metrics)
   1108 
   1109     def evaluate(self, x, y, batch_size=32, verbose=1, sample_weight=None):

/home/hoangnt/anaconda3/lib/python3.5/site-packages/keras/engine/training.py in _fit_loop(self, f, ins, out_labels, batch_size, nb_epoch, verbose, callbacks, val_f, val_ins, shuffle, callback_metrics)
    823                 batch_logs['size'] = len(batch_ids)
    824                 callbacks.on_batch_begin(batch_index, batch_logs)
--> 825                 outs = f(ins_batch)
    826                 if type(outs) != list:
    827                     outs = [outs]

/home/hoangnt/anaconda3/lib/python3.5/site-packages/keras/backend/theano_backend.py in __call__(self, inputs)
    655     def __call__(self, inputs):
    656         assert type(inputs) in {list, tuple}
--> 657         return self.function(*inputs)
    658 
    659 

/home/hoangnt/anaconda3/lib/python3.5/site-packages/theano/compile/function_module.py in __call__(self, *args, **kwargs)
    869                     node=self.fn.nodes[self.fn.position_of_error],
    870                     thunk=thunk,
--> 871                     storage_map=getattr(self.fn, 'storage_map', None))
    872             else:
    873                 # old-style linkers raise their own exceptions

/home/hoangnt/anaconda3/lib/python3.5/site-packages/theano/gof/link.py in raise_with_op(node, thunk, exc_info, storage_map)
    312         # extra long error message in that case.
    313         pass
--> 314     reraise(exc_type, exc_value, exc_trace)
    315 
    316 

/home/hoangnt/anaconda3/lib/python3.5/site-packages/six.py in reraise(tp, value, tb)
    683             value = tp()
    684         if value.__traceback__ is not tb:
--> 685             raise value.with_traceback(tb)
    686         raise value
    687 

/home/hoangnt/anaconda3/lib/python3.5/site-packages/theano/compile/function_module.py in __call__(self, *args, **kwargs)
    857         t0_fn = time.time()
    858         try:
--> 859             outputs = self.fn()
    860         except Exception:
    861             if hasattr(self.fn, 'position_of_error'):

IndexError: index 10312 is out of bounds for size 10312
Apply node that caused the error: AdvancedSubtensor1(nce_weights_embedding_W, Reshape{1}.0)
Toposort index: 25
Inputs types: [TensorType(float32, matrix), TensorType(int32, vector)]
Inputs shapes: [(10312, 128), (32,)]
Inputs strides: [(512, 4), (4,)]
Inputs values: ['not shown', 'not shown']
Outputs clients: [[Reshape{2}(AdvancedSubtensor1.0, TensorConstant{[ -1 128]})]]

Backtrace when the node is created(use Theano flag traceback.limit=N to make it longer):
  File "/home/hoangnt/anaconda3/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2869, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-4-5eba8538698e>", line 1, in <module>
    model.build()
  File "../src/mane/prototype/embeddings.py", line 151, in build
    init=self.init_normal, name="nce_weights_embedding")(class_in)
  File "/home/hoangnt/anaconda3/lib/python3.5/site-packages/keras/engine/topology.py", line 511, in __call__
    self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
  File "/home/hoangnt/anaconda3/lib/python3.5/site-packages/keras/engine/topology.py", line 569, in add_inbound_node
    Node.create_node(self, inbound_layers, node_indices, tensor_indices)
  File "/home/hoangnt/anaconda3/lib/python3.5/site-packages/keras/engine/topology.py", line 150, in create_node
    output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0]))
  File "/home/hoangnt/anaconda3/lib/python3.5/site-packages/keras/layers/embeddings.py", line 137, in call
    out = K.gather(W, x)
  File "/home/hoangnt/anaconda3/lib/python3.5/site-packages/keras/backend/theano_backend.py", line 221, in gather
    return reference[indices]

HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.

In [ ]: