@@ -36,7 +36,7 @@ def get_graph_nbrhd(train_graph, ent, exclude_tuple):
36
36
# er not in train_graph.reverse_kg_data[ent][nbr]]
37
37
(train_graph .reverse_kg_data [ent ][nbr ] - set ([er ]))]
38
38
neighborhood += rev_nighborhood
39
- neighborhood = np .array (list (set (neighborhood )), dtype = np . int )
39
+ neighborhood = np .array (list (set (neighborhood )), dtype = int )
40
40
return neighborhood
41
41
42
42
@@ -55,7 +55,7 @@ def get_graph_nbrhd_with_rels(train_graph, ent, exclude_tuple):
55
55
# # er not in train_graph.reverse_kg_data[ent][nbr]]
56
56
# (train_graph.reverse_kg_data[ent][nbr] - set([er]))]
57
57
# neighborhood += rev_nighborhood
58
- neighborhood = np .array (neighborhood , dtype = np . int )
58
+ neighborhood = np .array (neighborhood , dtype = int )
59
59
return neighborhood
60
60
61
61
@@ -78,7 +78,7 @@ def get_graph_nbrhd_text(train_graph, ent, max_text_len):
78
78
# # er not in train_graph.reverse_kg_data[ent][nbr]]
79
79
# (train_graph.reverse_kg_data[ent][nbr] - set([er]))]
80
80
# neighborhood += rev_nighborhood
81
- neighborhood = np .array (neighborhood , dtype = np . int )
81
+ neighborhood = np .array (neighborhood , dtype = int )
82
82
return neighborhood
83
83
84
84
@@ -94,7 +94,7 @@ def get_graph_nbrhd_embd_text(train_graph, ent, max_text_nbrs):
94
94
if not neighborhood :
95
95
neighborhood = [[]]
96
96
neighborhood_emb = [np .zeros (train_graph .embeddings [0 ].size )]
97
- neighborhood = np .array (neighborhood , dtype = np . int )
97
+ neighborhood = np .array (neighborhood , dtype = int )
98
98
neighborhood_emb = np .array (neighborhood_emb , dtype = np .float32 )
99
99
if neighborhood .shape [0 ] > max_text_nbrs :
100
100
ids = np .random .choice (np .range (neighborhood .shape [0 ]),
@@ -162,7 +162,7 @@ def get_graph_nbrhd_paths(train_graph, ent, exclude_tuple):
162
162
neighborhood += paths
163
163
if not neighborhood :
164
164
neighborhood = [[]]
165
- neighborhood = np .array (neighborhood , dtype = np . int )
165
+ neighborhood = np .array (neighborhood , dtype = int )
166
166
return neighborhood
167
167
168
168
@@ -223,7 +223,7 @@ def get_graph_nbrhd_paths_randwalk(train_graph, ent, exclude_tuple,
223
223
if not neighborhood :
224
224
neighborhood = [[]]
225
225
# import pdb; pdb.set_trace()
226
- neighborhood = np .array (neighborhood , dtype = np . int )
226
+ neighborhood = np .array (neighborhood , dtype = int )
227
227
return neighborhood
228
228
229
229
@@ -354,7 +354,7 @@ def featurize_each_example(self, example_tuple):
354
354
# else:
355
355
# negatives = np.array(candidate_negatives)
356
356
negatives = sample_or_pad (
357
- np .array (candidate_negatives , dtype = np . int ), self .max_negatives ,
357
+ np .array (candidate_negatives , dtype = int ), self .max_negatives ,
358
358
pad_value = self .train_graph .ent_pad
359
359
)
360
360
# negatives is an array of shape (max_negatives)
@@ -377,8 +377,8 @@ def featurize_each_example(self, example_tuple):
377
377
nbrhd_fn = get_graph_nbrhd
378
378
pad_value = self .train_graph .ent_pad
379
379
if self .model_type == "distmult" :
380
- nbrs_s = np .array ([], dtype = np . int )
381
- nbrs_candidates = np .array ([], dtype = np . int )
380
+ nbrs_s = np .array ([], dtype = int )
381
+ nbrs_candidates = np .array ([], dtype = int )
382
382
elif self .model_type in ["source_attention" , "source_rel_attention" ,
383
383
"source_path_attention" ]:
384
384
nbrs_s = sample_or_pad (nbrhd_fn (self .train_graph , s , (s , r , t )),
@@ -396,7 +396,7 @@ def featurize_each_example(self, example_tuple):
396
396
get_graph_nbrhd_text (self .train_graph , s , self .max_text_len ),
397
397
self .max_text_neighbors , pad_value = text_pad_value
398
398
)
399
- nbrs_candidates = np .array ([], dtype = np . int )
399
+ nbrs_candidates = np .array ([], dtype = int )
400
400
else :
401
401
nbrs_s = sample_or_pad (nbrhd_fn (self .train_graph , s , (s , r , t )),
402
402
self .max_neighbors ,
@@ -417,7 +417,7 @@ def featurize_each_example(self, example_tuple):
417
417
if self .mode != "train" :
418
418
labels = [t ]
419
419
else :
420
- labels = np .zeros (candidates .shape [0 ], dtype = np . int )
420
+ labels = np .zeros (candidates .shape [0 ], dtype = int )
421
421
labels [0 ] = 1
422
422
idx = np .arange (candidates .shape [0 ])
423
423
np .random .shuffle (idx )
0 commit comments