anjishnu commented on issue #8625: Attempting to write a relation network in 
Gluon
URL: 
https://github.com/apache/incubator-mxnet/issues/8625#issuecomment-343760917
 
 
   I guess I essentially need to do the equivalent of the code below, but with 
the all_relations array being a memory view rather than a copy... 
   
   ```python
           num_relations = num_objects * num_objects
           #all_relations = []
           all_relations = mx.nd.zeros((batch_size * num_relations, hidden_dim 
* 2))
           for i in range(num_objects):
               first_object = z1[:, i, :]
               for j in range(num_objects):
                   second_object = z2[:, j, :]
                   relation_vector = mx.nd.concat(first_object, second_object, 
dim=1)
                   start_index = ((i * num_objects) + j) * batch_size
                   #all_relations.append(relation_vector)
                   all_relations[start_index : start_index + batch_size] = 
relation_vector
   
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to