Repository navigation
Expand file tree
/
Copy pathtest.py
More file actions
61 lines (47 loc) · 1.4 KB
/
Copy pathtest.py
File metadata and controls
61 lines (47 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
import argparse
import pprint
from jetson_utils import getLogger, Env, String, as_dtype, cudaDeviceQuery
log = getLogger(__name__)
__all__ = ['Test']
class Test:
@staticmethod
def functions(**kwargs):
return dict(
logging = Test.logging,
env = Test.env,
table = Test.table,
dtypes = Test.dtypes,
cuda = Test.cuda,
)
@staticmethod
def all(**kwargs):
for k,v in Test.functions(**kwargs).items():
log.warning(f"RUNNING jetson_utils.test.{k}()\n")
v(**kwargs)
print('')
log.success(f"✅ DONE jetson_utils.test.{k}()\n")
@staticmethod
def logging(msg: str=None, **kwargs):
if not msg:
msg = "Testing abc 123"
for k,v in log.getLevels().items():
log.log(v, f"log.log({k.upper()}) - {msg}")
print('')
for k,v in log.getLevels().items():
getattr(log, k)(f"log.{k}() - {msg}")
@staticmethod
def env(**kwargs):
print(Env)
@staticmethod
def table(**kwargs):
print(String.table(Env))
@staticmethod
def dtypes(**kwargs):
print(as_dtype('float16', to='np'))
print(as_dtype('int8', to='np'))
@staticmethod
def cuda(**kwargs):
pprint.pprint(cudaDeviceQuery(), indent=2)
if __name__ == '__main__':
Test.all()