How to use run_benchmark method in lisa

Best Python code snippet using lisa_python

benchmark_supervised.py

Source:benchmark_supervised.py Github

copy

Full Screen

2from benchmarks.utils.pyg_train_supervised import cross_validation_with_val_set3from benchmarks.models.supervised.gcn_models import GCN_2, PyG_GCN4from benchmarks.models.supervised.gin_models import GIN_2, PyG_GIN, GIN0_2, PyG_GIN05from benchmarks.models.supervised.sage_models import GraphSAGE_2, PyG_GraphSAGE6def run_benchmark(7 name,8 model_nn,9 num_layers,10 num_hidden_units,11 folds=10,12 batch_size=128,13 lr=0.01,14 weight_decay=0,15 lr_decay_factor=0.5,16 lr_decay_step_size=50,17 num_epochs=100,18 debug=False,19 **kwargs20):21 dataset = get_TU_dataset(name)22 model = model_nn(dataset, num_layers, num_hidden_units, **kwargs)23 return cross_validation_with_val_set(24 dataset,25 model,26 folds=folds,27 epochs=num_epochs,28 batch_size=batch_size,29 lr=lr,30 lr_decay_factor=lr_decay_factor,31 lr_decay_step_size=lr_decay_step_size,32 weight_decay=weight_decay,33 debug=debug,34 )35def run_pytorch_benchmarks_gcn(name, num_layers, num_hidden_units):36 run_benchmark(name, GCN_2, num_layers, num_hidden_units)37 run_benchmark(name, PyG_GCN, num_layers, num_hidden_units)38def run_pytorch_benchmarks_gin_0(name, num_layers, num_hidden_units):39 run_benchmark(name, GIN0_2, num_layers, num_hidden_units)40 run_benchmark(name, PyG_GIN0, num_layers, num_hidden_units)41def run_pytorch_benchmarks_gin(name, num_layers, num_hidden_units):42 run_benchmark(name, GIN_2, num_layers, num_hidden_units)43 run_benchmark(name, PyG_GIN, num_layers, num_hidden_units)44def run_pytorch_benchmarks_sage(name, num_layers, num_hidden_units):45 run_benchmark(name, GraphSAGE_2, num_layers, num_hidden_units)46 run_benchmark(name, PyG_GraphSAGE, num_layers, num_hidden_units)47if __name__ == "__main__":...

Full Screen

Full Screen

xxt.py

Source:xxt.py Github

copy

Full Screen

...27 for i in nb.prange(n):28 xi = x[i] # [m]29 out[i] = x @ xi30 return out31def run_benchmark(fn: tp.Callable, state):32 x = get_x(seed, n, m, dtype)33 # warmup34 fn(x)35 while state:36 fn(x)37@benchmark.register38def numpy_impl(state):39 def f(x):40 return x @ x.T41 run_benchmark(f, state)42@benchmark.register43def xxt_v0_impl(state):44 run_benchmark(xxt_v0, state)45@benchmark.register46def xxt_v1_impl(state):47 run_benchmark(xxt_v1, state)48@benchmark.register49def xxt_v2_impl(state):50 run_benchmark(xxt_v2, state)51if __name__ == "__main__":...

Full Screen

Full Screen

compare.py

Source:compare.py Github

copy

Full Screen

1#!/usr/bin/env python2# coding: utf-83import timeit4def run_benchmark(M, N, K, n):5 count = 506 setup_string = 'import numpy as np; a = np.random.random_sample(({0}, {2})); b = np.random.random_sample(({2}, {1}))'.format(M, N, K)7 #print(setup_string)8 elapsed = timeit.timeit(9 setup=setup_string,10 stmt='np.dot(a, b)',11 number=count)12 average_millis = (elapsed / count) * 100013 # 1.11 ops/sec ±0.22% n = 7 µ = 904ms14 # 235 ops/sec ±2.86% n = 59 µ = 4ms15 print("ok {3} {0}x{2} . {2}x{1}".format(M, N, K, n))16 print("# {0:.2f} ops/sec n = {1} µ = {2:.2f}ms".format(count / elapsed, count, average_millis))17print("TAP version 13")18run_benchmark( 128, 128, 128, 1)19run_benchmark( 128, 128, 256, 2)20run_benchmark( 256, 256, 256, 3)21run_benchmark( 512, 512, 256, 4)22run_benchmark( 256, 256, 512, 5)23run_benchmark( 512, 512, 512, 6)24run_benchmark(1024, 1024, 512, 7)25run_benchmark(1024, 1024, 512, 8)26run_benchmark(1024, 1024, 1024, 9)27run_benchmark(2048, 2048, 2048, 10)28print("\n1..9")29print("# tests 9")30print("# pass 9")...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful