From e6fcc4ef2c4df643126dc1557ccaab2891e92b2e Mon Sep 17 00:00:00 2001 From: Yong Wu Date: Thu, 27 Apr 2023 10:57:48 -0700 Subject: [PATCH] fix black --- gallery/how_to/tune_with_autoscheduler/tune_sparse_x86.py | 6 +++++- gallery/how_to/work_with_relay/build_gcn.py | 6 ++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/gallery/how_to/tune_with_autoscheduler/tune_sparse_x86.py b/gallery/how_to/tune_with_autoscheduler/tune_sparse_x86.py index e5e420e72664b..a9c45c15ce823 100644 --- a/gallery/how_to/tune_with_autoscheduler/tune_sparse_x86.py +++ b/gallery/how_to/tune_with_autoscheduler/tune_sparse_x86.py @@ -239,6 +239,7 @@ def apply_func(search_policy, state, stage_id): # After some measurement trials, we can load the best schedule from the log # file and apply it. + def tune_and_evaluate(tune_option, search_policy): # Run auto-tuning (search) task.tune(tune_option, search_policy) @@ -275,11 +276,14 @@ def tune_and_evaluate(tune_option, search_policy): print( "Execution time of this operator: %.3f ms" % ( - np.median(evaluator(X_tvm, W_data_tvm, W_indices_tvm, W_indptr_tvm, B_tvm, Y_tvm).results) + np.median( + evaluator(X_tvm, W_data_tvm, W_indices_tvm, W_indptr_tvm, B_tvm, Y_tvm).results + ) * 1000 ) ) + # Notice: We do not run the tuning in our webpage server since it takes too long. # Uncomment the following line to run it by yourself. # tune_and_evaluate(tune_option, search_policy) diff --git a/gallery/how_to/work_with_relay/build_gcn.py b/gallery/how_to/work_with_relay/build_gcn.py index b77047e25c746..a4bb5d58cd303 100644 --- a/gallery/how_to/work_with_relay/build_gcn.py +++ b/gallery/how_to/work_with_relay/build_gcn.py @@ -115,7 +115,7 @@ def evaluate(g, logits): dgl_g = dataset[0] num_layers = 1 num_hidden = 16 -features = dgl_g.ndata['feat'] +features = dgl_g.ndata["feat"] infeat_dim = features.shape[1] num_classes = dataset.num_classes @@ -232,9 +232,7 @@ def GraphConv(layer_name, input_dim, output_dim, adj, input, norm=None, bias=Tru def prepare_params(g): params = {} - params["infeats"] = g.ndata['feat'].numpy().astype( - "float32" - ) # Only support float32 as feature for now + params["infeats"] = g.ndata["feat"].numpy().astype("float32") # Generate adjacency matrix nx_graph = dgl.to_networkx(g)