@@ -290,14 +290,14 @@ def evaluate(cfg: DictConfig):
290290 np .linspace (start = 0 , stop = cfg .LENGTH , num = num_x , endpoint = True ),
291291 np .linspace (start = 0 , stop = cfg .WIDTH , num = num_y , endpoint = True ),
292292 )
293- x_faltten = paddle .to_tensor (
293+ x_flatten = paddle .to_tensor (
294294 x_grad .flatten ()[:, None ], dtype = paddle .get_default_dtype (), stop_gradient = False
295295 )
296- y_faltten = paddle .to_tensor (
296+ y_flatten = paddle .to_tensor (
297297 y_grad .flatten ()[:, None ], dtype = paddle .get_default_dtype (), stop_gradient = False
298298 )
299299 outs_pred = solver .predict (
300- {"x" : x_faltten , "y" : y_faltten }, batch_size = num_cords , no_grad = False
300+ {"x" : x_flatten , "y" : y_flatten }, batch_size = num_cords , no_grad = False
301301 )
302302
303303 # generate label
@@ -309,11 +309,11 @@ def evaluate(cfg: DictConfig):
309309 paddle .to_tensor (Q , dtype = paddle .get_default_dtype ())
310310 * paddle .sin (
311311 paddle .to_tensor (np .pi / cfg .LENGTH , dtype = paddle .get_default_dtype ())
312- * x_faltten ,
312+ * x_flatten ,
313313 )
314314 * paddle .sin (
315315 paddle .to_tensor (np .pi / cfg .WIDTH , dtype = paddle .get_default_dtype ())
316- * y_faltten ,
316+ * y_flatten ,
317317 )
318318 )
319319
@@ -334,10 +334,10 @@ def compute_outs(w, x, y):
334334 Q_y = - jacobian ((w_x2 + w_y2 ), y ) * D
335335 return {"Mx" : M_x , "Mxy" : M_xy , "My" : M_y , "Qx" : Q_x , "Qy" : Q_y , "w" : w }
336336
337- outs = compute_outs (outs_pred ["u" ], x_faltten , y_faltten )
337+ outs = compute_outs (outs_pred ["u" ], x_flatten , y_flatten )
338338
339339 # plotting
340- griddata_points = paddle .concat ([x_faltten , y_faltten ], axis = - 1 ).numpy ()
340+ griddata_points = paddle .concat ([x_flatten , y_flatten ], axis = - 1 ).numpy ()
341341 griddata_xi = (x_grad , y_grad )
342342 boundary = [0 , cfg .LENGTH , 0 , cfg .WIDTH ]
343343 plotting (
@@ -410,12 +410,13 @@ def inference(cfg: DictConfig):
410410 start = 0 , stop = cfg .WIDTH , num = num_y , endpoint = True , dtype = np .float32
411411 ),
412412 )
413- x_faltten = x_grad .reshape (- 1 , 1 )
414- y_faltten = y_grad .reshape (- 1 , 1 )
413+ x_flatten = x_grad .reshape (- 1 , 1 )
414+ y_flatten = y_grad .reshape (- 1 , 1 )
415415
416- output_dict = predictor .predict (
417- {"x" : x_faltten , "y" : y_faltten }, cfg .INFER .batch_size
418- )
416+ with ppsci .misc .Timer ("infer" ):
417+ output_dict = predictor .predict (
418+ {"x" : x_flatten , "y" : y_flatten }, cfg .INFER .batch_size
419+ )
419420
420421 # mapping data to cfg.INFER.output_keys
421422 output_dict = {
@@ -424,7 +425,7 @@ def inference(cfg: DictConfig):
424425 }
425426
426427 # plotting
427- griddata_points = np .concatenate ([x_faltten , y_faltten ], axis = - 1 )
428+ griddata_points = np .concatenate ([x_flatten , y_flatten ], axis = - 1 )
428429 griddata_xi = (x_grad , y_grad )
429430 boundary = [0 , cfg .LENGTH , 0 , cfg .WIDTH ]
430431 plotting (
0 commit comments