mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-07 21:42:08 -07:00
fix sample processor
This commit is contained in:
parent
3aa2b56eda
commit
f8469fe4d7
3 changed files with 36 additions and 127 deletions
|
@ -1,12 +1,14 @@
|
|||
import numpy as np
|
||||
|
||||
def random_normal( size=(1,), trunc_val = 2.5 ):
|
||||
def random_normal( size=(1,), trunc_val = 2.5, rnd_state=None ):
|
||||
if rnd_state is None:
|
||||
rnd_state = np.random
|
||||
len = np.array(size).prod()
|
||||
result = np.empty ( (len,) , dtype=np.float32)
|
||||
|
||||
for i in range (len):
|
||||
while True:
|
||||
x = np.random.normal()
|
||||
x = rnd_state.normal()
|
||||
if x >= -trunc_val and x <= trunc_val:
|
||||
break
|
||||
result[i] = (x / trunc_val)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue