| """Print the two golden digests from the local build.""" |
| import hashlib |
| import os |
| import sys |
|
|
| ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| sys.path.insert(0, ROOT) |
| sys.path.insert(0, os.path.join(ROOT, "tests")) |
|
|
| import load_local |
|
|
| svr = load_local.load() |
|
|
| import types |
|
|
| try: |
| import kernels |
| except ImportError: |
| kernels = types.ModuleType("kernels") |
| sys.modules["kernels"] = kernels |
| kernels.get_kernel = lambda *a, **k: svr |
|
|
| import numpy as np |
| import torch |
| from test_svr import hash_rgba_u8 |
|
|
|
|
| def digest(t): |
| return hashlib.sha256(t.detach().cpu().numpy().tobytes()).hexdigest() |
|
|
|
|
| u8 = hash_rgba_u8(2, 384, 416, salt=101).cuda() |
| out8 = svr.upscale(u8, out_hw=(704, 768), center=[[0.46, 0.52], [0.54, 0.52]], |
| radii=(0.28, 0.66), sharp=0.45) |
| print(f'"eyes_uint8": "{digest(out8)}",') |
| f32 = (hash_rgba_u8(1, 256, 288, salt=202).cuda().float() / 255.0).contiguous() |
| outf = svr.upscale(f32, out_hw=(480, 512), center=(0.5, 0.47), |
| radii=(0.3, 0.7), sharp=0.35) |
| print(f'"eyes_f32": "{digest(outf)}",') |
|
|