mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-16 10:03:41 -07:00
SAEHD: added 'dfuhd' and 'liaeuhd' archi
This commit is contained in:
parent
e5f736680d
commit
eddebedcf6
5 changed files with 190 additions and 155 deletions
16
core/leras/layers/DenseNorm.py
Normal file
16
core/leras/layers/DenseNorm.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from core.leras import nn
|
||||
tf = nn.tf
|
||||
|
||||
class DenseNorm(nn.LayerBase):
|
||||
def __init__(self, dense=False, eps=1e-06, dtype=None, **kwargs):
|
||||
self.dense = dense
|
||||
if dtype is None:
|
||||
dtype = nn.floatx
|
||||
self.eps = tf.constant(eps, dtype=dtype, name="epsilon")
|
||||
|
||||
super().__init__(**kwargs)
|
||||
|
||||
def __call__(self, x):
|
||||
return x * tf.rsqrt(tf.reduce_mean(tf.square(x), axis=-1, keepdims=True) + self.eps)
|
||||
|
||||
nn.DenseNorm = DenseNorm
|
Loading…
Add table
Add a link
Reference in a new issue