File size: 1,069 Bytes
5506acb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""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)}",')