@@ -179,14 +179,16 @@ def _get_bias(self):
179179 bias ["layer_" + str (layer )] = []
180180 if self .type_one_side :
181181 for ii in range (0 , self .ntypes ):
182- tensor_value = np .frombuffer (self .embedding_net_nodes [f"filter_type_all{ self .suffix } /bias_{ layer } _{ ii } " ].tensor_content )
183- tensor_shape = tf .TensorShape (self .embedding_net_nodes [f"filter_type_all{ self .suffix } /bias_{ layer } _{ ii } " ].tensor_shape ).as_list ()
182+ node = self .embedding_net_nodes [f"filter_type_all{ self .suffix } /bias_{ layer } _{ ii } " ]
183+ tensor_value = np .frombuffer (node .tensor_content , dtype = tf .as_dtype (node .dtype ).as_numpy_dtype )
184+ tensor_shape = tf .TensorShape (node .tensor_shape ).as_list ()
184185 bias ["layer_" + str (layer )].append (np .reshape (tensor_value , tensor_shape ))
185186 else :
186187 for ii in range (0 , self .ntypes * self .ntypes ):
187188 if (ii // self .ntypes , int (ii % self .ntypes )) not in self .exclude_types :
188- tensor_value = np .frombuffer (self .embedding_net_nodes [f"filter_type_{ ii // self .ntypes } { self .suffix } /bias_{ layer } _{ ii % self .ntypes } " ].tensor_content )
189- tensor_shape = tf .TensorShape (self .embedding_net_nodes [f"filter_type_{ ii // self .ntypes } { self .suffix } /bias_{ layer } _{ ii % self .ntypes } " ].tensor_shape ).as_list ()
189+ node = self .embedding_net_nodes [f"filter_type_{ ii // self .ntypes } { self .suffix } /bias_{ layer } _{ ii % self .ntypes } " ]
190+ tensor_value = np .frombuffer (node .tensor_content , dtype = tf .as_dtype (node .dtype ).as_numpy_dtype )
191+ tensor_shape = tf .TensorShape (node .tensor_shape ).as_list ()
190192 bias ["layer_" + str (layer )].append (np .reshape (tensor_value , tensor_shape ))
191193 else :
192194 bias ["layer_" + str (layer )].append (np .array ([]))
@@ -198,14 +200,16 @@ def _get_matrix(self):
198200 matrix ["layer_" + str (layer )] = []
199201 if self .type_one_side :
200202 for ii in range (0 , self .ntypes ):
201- tensor_value = np .frombuffer (self .embedding_net_nodes [f"filter_type_all{ self .suffix } /matrix_{ layer } _{ ii } " ].tensor_content )
202- tensor_shape = tf .TensorShape (self .embedding_net_nodes [f"filter_type_all{ self .suffix } /matrix_{ layer } _{ ii } " ].tensor_shape ).as_list ()
203+ node = self .embedding_net_nodes [f"filter_type_all{ self .suffix } /matrix_{ layer } _{ ii } " ]
204+ tensor_value = np .frombuffer (node .tensor_content , dtype = tf .as_dtype (node .dtype ).as_numpy_dtype )
205+ tensor_shape = tf .TensorShape (node .tensor_shape ).as_list ()
203206 matrix ["layer_" + str (layer )].append (np .reshape (tensor_value , tensor_shape ))
204207 else :
205208 for ii in range (0 , self .ntypes * self .ntypes ):
206209 if (ii // self .ntypes , int (ii % self .ntypes )) not in self .exclude_types :
207- tensor_value = np .frombuffer (self .embedding_net_nodes [f"filter_type_{ ii // self .ntypes } { self .suffix } /matrix_{ layer } _{ ii % self .ntypes } " ].tensor_content )
208- tensor_shape = tf .TensorShape (self .embedding_net_nodes [f"filter_type_{ ii // self .ntypes } { self .suffix } /matrix_{ layer } _{ ii % self .ntypes } " ].tensor_shape ).as_list ()
210+ node = self .embedding_net_nodes [f"filter_type_{ ii // self .ntypes } { self .suffix } /matrix_{ layer } _{ ii % self .ntypes } " ]
211+ tensor_value = np .frombuffer (node .tensor_content , dtype = tf .as_dtype (node .dtype ).as_numpy_dtype )
212+ tensor_shape = tf .TensorShape (node .tensor_shape ).as_list ()
209213 matrix ["layer_" + str (layer )].append (np .reshape (tensor_value , tensor_shape ))
210214 else :
211215 matrix ["layer_" + str (layer )].append (np .array ([]))
0 commit comments