repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
DeepFaceLive | xlib/face/FPose.py | .py | from typing import Tuple
import numpy as np
from .. import math as lib_math
from .IState import IState
class FPose(IState):
"""
Describes face pitch/yaw/roll
"""
def __init__(self):
self._pyr : np.ndarray = None
def restore_state(self, state : dict):
self._pyr = IState._restore_... | 53 | 1,413 |
DeepFaceLive | xlib/face/FLandmarks2D.py | .py | from typing import Tuple
import cv2
import numpy as np
from .. import math as lib_math
from ..math import Affine2DMat, Affine2DUniMat
from .ELandmarks2D import ELandmarks2D
from .FRect import FRect
from .IState import IState
class FLandmarks2D(IState):
def __init__(self):
"""
Describes 2D face l... | 1,355 | 52,478 |
DeepFaceLive | xlib/face/FMask.py | .py | import uuid
from typing import Union
from enum import IntEnum
class FMask:
class Type(IntEnum):
WHOLE_FACE = 0
def __init__(self, _from_pickled=False):
"""
"""
self._uuid : Union[bytes, None] = uuid.uuid4().bytes if not _from_pickled else None
self._mask_type : ... | 40 | 1,564 |
DeepFaceLive | xlib/face/IState.py | .py | from typing import Any, Union
import numpy as np
class IState:
"""
"""
def __getstate__(self):
return self.__dict__.copy()
def __setstate__(self, d):
self.__init__()
self.__dict__.update(d)
@staticmethod
def _dump_IState_obj(obj : Union[Any, None]) -> Union[Any, None... | 69 | 1,682 |
DeepFaceLive | xlib/face/ELandmarks2D.py | .py | from enum import IntEnum
class ELandmarks2D(IntEnum):
L5 = 0
L68 = 1
L106 = 2
L468 = 3 | 7 | 103 |
DeepFaceLive | xlib/face/EMaskType.py | .py | from enum import IntEnum
class EMaskType(IntEnum):
UNDEFINED = 0 | 4 | 69 |
DeepFaceLive | xlib/face/Faceset.py | .py | import pickle
import uuid
from pathlib import Path
from typing import Generator, Iterable, List, Union
import cv2
import h5py
import numpy as np
from .. import console as lib_con
from .FMask import FMask
from .UFaceMark import UFaceMark
from .UImage import UImage
from .UPerson import UPerson
class Faceset:
def... | 315 | 11,506 |
DeepFaceLive | xlib/sjob/__init__.py | .py | """
Job lib using subprocesses
"""
import multiprocessing
if multiprocessing.get_start_method() != 'spawn':
multiprocessing.set_start_method("spawn", force=True)
from .run_sequence import run_sequence | 9 | 206 |
DeepFaceLive | xlib/sjob/run_sequence.py | .py | import multiprocessing
from typing import Callable, List
from .. import console as lib_con
def _run_sequence(barrier, init_func, init_kwargs, final_func, process_func, pipe):
state = {}
if init_func is not None:
init_func(state, **init_kwargs)
barrier.wait()
while True:
if pipe.poll... | 92 | 2,722 |
DeepFaceLive | xlib/mp/MPSPSCMRRingData.py | .py | import multiprocessing
from operator import mul
import uuid
from typing import Union
from ..io import FormattedMemoryViewIO
from .MPSharedMemory import MPSharedMemory
class MPSPSCMRRingData:
"""
Multiprocess lockless Single Producer, Single Consumer, Multi Reader Ring Data.
Producer knows how many data i... | 186 | 5,793 |
DeepFaceLive | xlib/mp/MPWeakHeap.py | .py | import multiprocessing
import uuid
from typing import Union
from ..io import FormattedMemoryViewIO
from .MPSharedMemory import MPSharedMemory
class MPWeakHeap:
"""
Multiprocess weak heap.
heap structure
|ring_head_block_offset block block block ...|
block structure:
---
(8) bl... | 223 | 7,112 |
DeepFaceLive | xlib/mp/PMPI.py | .py | import multiprocessing
from multiprocessing.connection import Connection
class PMPI:
"""
Paired Message Processing Interface
send and recv messages between processes via pipe
"""
def __init__(self, pipe : Connection = None):
self.pipe = pipe
self.funcs = {}
def set_pipe(self,... | 72 | 2,023 |
DeepFaceLive | xlib/mp/MPWorker.py | .py | import multiprocessing
import threading
import time
import traceback
import weakref
from typing import List
class MPWorker:
def __init__(self, sub_args : List = None,
process_count : int = None ):
"""
base class for multi process worker
provides messaging interface b... | 143 | 4,341 |
DeepFaceLive | xlib/mp/RWLock.py | .py | import multiprocessing
class RWLock():
"""
Multiprocessing non-recursive reader-writer lock
"""
def __init__(self):
self._a = multiprocessing.RawArray('I', 2)
#_a[0] : readers counter
#_a[1] : writer flag
self._v = memoryview(self._a).cast('B').cast('I')
self._l ... | 83 | 2,084 |
DeepFaceLive | xlib/mp/MPAtomicInt32.py | .py | import multiprocessing
class MPAtomicInt32:
"""
Multiprocess atomic int32 variable
using multiprocessing.RawArray at specified index
"""
def __init__(self, ar : multiprocessing.RawArray=None, index=None):
if ar is None:
ar = multiprocessing.RawArray('B', 4)
self._ar = a... | 65 | 1,925 |
DeepFaceLive | xlib/mp/MPSharedMemory.py | .py | import multiprocessing
class MPSharedMemory:
def __init__(self, size):
self._size = size
self._ar = multiprocessing.RawArray('B', self._size)
self._mv = memoryview(self._ar).cast('B')
def get_ar(self) -> multiprocessing.RawArray:
"""
returns multiprocessing.RawArray
... | 28 | 683 |
DeepFaceLive | xlib/mp/csw/Flag.py | .py | from ...python import EventListener
from .CSWBase import ControlClient, ControlHost
class _FlagBase:
def __init__(self):
self._flag = None
self._on_flag_evl = EventListener()
self._call_on_msg('flag', self._on_msg_flag)
def _on_msg_flag(self, flag):
self._set_flag(flag)
... | 63 | 1,621 |
DeepFaceLive | xlib/mp/csw/Paths.py | .py | from collections import Iterable
from enum import IntEnum
from pathlib import Path
from typing import List, Union
from ...python import EventListener
from .CSWBase import ControlClient, ControlHost
class _PathBase:
def __init__(self):
self._paths = []
self._on_paths_evl = EventListener()
... | 145 | 4,634 |
DeepFaceLive | xlib/mp/csw/InfoLabel.py | .py | from typing import Union, List
from ...python import EventListener
from .CSWBase import ControlClient, ControlHost
class InfoLabel:
"""
"""
class Config:
def __init__(self, label : Union[str, None] = None,
info_icon = False,
info_lines : Uni... | 49 | 1,216 |
DeepFaceLive | xlib/mp/csw/Progress.py | .py | from typing import Union
from ...python import EventListener
from .CSWBase import ControlClient, ControlHost
class _ProgressBase:
def __init__(self):
self._progress = None
self._on_progress_evl = EventListener()
self._call_on_msg('progress', self._on_msg_progress)
def _on_msg_progre... | 85 | 2,510 |
DeepFaceLive | xlib/mp/csw/CSWBase.py | .py | import multiprocessing
import threading
import time
import traceback
from enum import IntEnum
from ... import db as lib_db
from ...python import Disposable, EventListener
from ..PMPI import PMPI
class Control:
"""
Base class of control elements between 2 processes.
"""
class State(IntEnum):
... | 500 | 16,236 |
DeepFaceLive | xlib/mp/csw/DynamicSingleSwitch.py | .py | from collections import Iterable
from typing import List, Union
from ...python import EventListener
from .CSWBase import ControlClient, ControlHost
class _DynamicSingleSwitchBase:
def __init__(self):
self._on_selected_evl = EventListener()
self._on_choices_evl = EventListener()
self._ca... | 175 | 6,011 |
DeepFaceLive | xlib/mp/csw/Number.py | .py | import numpy as np
from ...python import EventListener
from .CSWBase import ControlClient, ControlHost
class _NumberBase:
def __init__(self):
self._number = None
self._on_number_evl = EventListener()
self._call_on_msg('number', self._on_msg_number)
def _on_msg_number(self, number):
... | 108 | 3,466 |
DeepFaceLive | xlib/mp/csw/Error.py | .py | from typing import Union
from ...python import EventListener
from .CSWBase import ControlClient, ControlHost
class Error:
"""
One-way error control.
"""
class Client(ControlClient):
def __init__(self):
ControlClient.__init__(self)
self._on_error_evl = EventListener... | 54 | 1,145 |
DeepFaceLive | xlib/mp/csw/Text.py | .py | from ...python import EventListener
from .CSWBase import ControlClient, ControlHost
class _TextBase:
def __init__(self):
self._text = None
self._on_text_evl = EventListener()
self._call_on_msg('text', self._on_msg_text)
def _on_msg_text(self, text):
self._set_text(text)
... | 68 | 1,657 |
DeepFaceLive | xlib/mp/csw/Signal.py | .py | from ...python import EventListener
from .CSWBase import ControlClient, ControlHost
class Signal:
class Host(ControlHost):
def __init__(self):
super().__init__()
self._signal_evl = EventListener()
self._call_on_msg('signal', self._on_msg_signal)
def call_on_si... | 28 | 678 |
DeepFaceLive | xlib/mp/csw/InfoBlock.py | .py | from typing import Union, List
from ...python import EventListener
from .CSWBase import ControlClient, ControlHost
class InfoBlock:
"""
"""
class Client(ControlClient):
def __init__(self):
ControlClient.__init__(self)
self._on_info_evl = EventListener()
sel... | 49 | 1,038 |
DeepFaceLive | xlib/python/EventListener.py | .py | from collections import Iterable
class EventListener:
__slots__ = ['_funcs']
def __init__(self):
self._funcs = []
def has_listeners(self):
return len(self._funcs) != 0
def add(self, func_or_list):
if isinstance(func_or_list, Iterable):
func_or_list = tuple(func_or... | 25 | 605 |
DeepFaceLive | xlib/python/__init__.py | .py | class dotdict(dict):
"""dot.notation access to dictionary attributes"""
__getattr__ = dict.get
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
from .EventListener import EventListener
def all_is_not_None(*args): return all(x is not None for x in args)
def all_is_None(*args): return all(x... | 43 | 1,001 |
DeepFaceLive | xlib/time/time_.py | .py | import platform
import time
from collections import deque
from datetime import datetime
import numpy as np
if platform.system() == 'Windows':
from xlib.api.win32 import kernel32, wintypes
_perf_freq = wintypes.LARGE_INTEGER()
if not kernel32.QueryPerformanceFrequency(_perf_freq):
raise Exception('... | 87 | 2,522 |
DeepFaceLive | xlib/avecl/__init__.py | .py | """
AveCL ! Make OpenCL great again.
Lightweight ndarray library using OpenCL 1.2 written in pure python.
Applicable for high-performance general purpose n-dim array computations for every device that supports OpenCL 1.2.
Supports any dtype except float64.
Works in python 3.5+. Dependencies: numpy.
This lib uses rel... | 37 | 1,379 |
DeepFaceLive | xlib/avecl/_internal/HKernel.py | .py | import numpy as np
class HKernel:
"""
Helper functions for Kernels
"""
_np_dtype_to_cl = { np.bool_ : 'bool',
np.int8 : 'char',
np.uint8 : 'uchar',
np.int16 : 'short',
np.uint16 : 'ushort',
... | 486 | 19,364 |
DeepFaceLive | xlib/avecl/_internal/HArgs.py | .py | from typing import List
import numpy as np
from .backend import Device
from .HTensor import HTensor
from .HType import HType
from .Tensor import Tensor
from .AShape import AShape
class HArgs:
"""
Helper functions for list of arguments
"""
@staticmethod
def decompose(args):
"""
de... | 107 | 3,238 |
DeepFaceLive | xlib/avecl/_internal/SCacheton.py | .py | class SCacheton:
"""
Static class for caching classes and vars by hashable arguments
"""
cachetons = {}
cachevars = {}
@staticmethod
def get(cls, *args, **kwargs):
"""
Get class cached by args/kwargs
If it does not exist, creates new with *args,**kwargs
All c... | 55 | 1,510 |
DeepFaceLive | xlib/avecl/_internal/AShape.py | .py | from collections import Iterable
from typing import Tuple, List
from .AAxes import AAxes
class AShape(Iterable):
__slots__ = ['shape','size','ndim']
def __init__(self, shape):
"""
Constructs valid shape from user argument
arguments
shape AShape
... | 157 | 4,644 |
DeepFaceLive | xlib/avecl/_internal/EInterpolation.py | .py | from enum import IntEnum, IntEnum
class EInterpolation(IntEnum):
NEAREST = 0
LINEAR = 1
CUBIC = 2
LANCZOS3 = 3
LANCZOS4 = 4 | 8 | 144 |
DeepFaceLive | xlib/avecl/_internal/TensorImpl.py | .py | from .op import *
from .AShape import *
from .backend import *
from .Tensor import Tensor
def Tensor__str__(self : Tensor): return f"T {self.name} {self.shape} {self.dtype.name}"
Tensor.__str__ = Tensor__str__
def Tensor__repr__(self : Tensor):
s = self.__str__() + '\n'
s += str(self.np()) + '\n'
s += se... | 95 | 2,670 |
DeepFaceLive | xlib/avecl/_internal/AAxes.py | .py | from collections import Iterable
class AAxes(Iterable):
__slots__ = ['axes','ndim','_inversed']
def __init__(self, axes, shape_ndim=None):
"""
Constructs AAxes from user argument
arguments
axes AAxes
Int
Iterable of ints
... | 169 | 5,150 |
DeepFaceLive | xlib/avecl/_internal/NTest.py | .py | import numpy as np
from . import op
from .backend import get_default_device, get_device, set_default_device
from .HType import HType
from .info import Conv2DInfo
from .initializer import InitCoords2DArange, InitRandomUniform
from .NCore import NCore
from .Tensor import Tensor
class NTest():
def test_all():
... | 803 | 30,228 |
DeepFaceLive | xlib/avecl/_internal/HTensor.py | .py | from typing import List, Union
from .Tensor import *
class HTensor:
"""
Helper functions for Tensor
"""
@staticmethod
def all_same_device( tensor_or_list : Union[Tensor, List[Tensor] ] ) -> bool:
"""
check if all tensors in a list use the same device
"""
if not is... | 23 | 560 |
DeepFaceLive | xlib/avecl/_internal/HType.py | .py | import operator
from typing import Iterable, List
import numpy as np
scalar_types = [int, float, np.uint8, np.int8, np.uint16, np.int16, np.uint32, np.int32, np.uint64, np.int64,
np.float16, np.float32, np.bool_]
np_scalar_types = [np.uint8, np.int8, np.uint16, np.int16, np.uint32, np.int32, np.uint64... | 80 | 2,223 |
DeepFaceLive | xlib/avecl/_internal/NCore.py | .py | from .SCacheton import SCacheton
from .Tensor import Tensor
from .backend import *
class NCore:
"""
core functions
"""
@staticmethod
def cleanup():
"""
try to cleanup all resources consumed by TensorCL.
can raise Exception
"""
SCacheton.cleanup()
cl... | 20 | 356 |
DeepFaceLive | xlib/avecl/_internal/Tensor.py | .py | import weakref
from typing import Iterable, Union
import numpy as np
from .AShape import *
from .backend import *
from .HType import *
class Tensor:
### CONSTRUCTORS
def __init__(self, shape : Union[AShape, Iterable],
dtype : np.dtype,
device : Union[None, int,... | 127 | 4,646 |
DeepFaceLive | xlib/avecl/_internal/initializer/InitConst.py | .py | from ..backend import Kernel
from ..HKernel import HKernel
from ..SCacheton import SCacheton
from ..Tensor import Tensor
from .Initializer import Initializer
class InitConst(Initializer):
def __init__(self, value=0):
"""
arguments
value(0)
"""
super().__init__()
... | 38 | 1,018 |
DeepFaceLive | xlib/avecl/_internal/initializer/InitCoords2DArange.py | .py | import numpy as np
from ..backend import Kernel
from ..HKernel import HKernel
from ..SCacheton import SCacheton
from ..Tensor import Tensor
from .Initializer import Initializer
class InitCoords2DArange(Initializer):
def __init__(self, h_start, h_stop, w_start, w_stop):
"""
Initialize (...,H,W,D) ... | 90 | 2,560 |
DeepFaceLive | xlib/avecl/_internal/initializer/InitRandomUniform.py | .py | import numpy as np
from ..backend import Kernel
from ..HKernel import HKernel
from ..SCacheton import SCacheton
from ..Tensor import Tensor
from .Initializer import Initializer
class InitRandomUniform(Initializer):
def __init__(self, low=0, high=1):
"""
arguments
low(0) low value
... | 61 | 2,123 |
DeepFaceLive | xlib/avecl/_internal/initializer/Initializer.py | .py | from ..Tensor import Tensor
class Initializer:
"""
Base class for tensor inititalizers
"""
def initialize_tensor(self, tensor : Tensor):
"""
Implement initialization of tensor
You can compute the data using python and then call buffer.set(numpy_value)
or call kernel.run... | 18 | 542 |
DeepFaceLive | xlib/avecl/_internal/op/binary_morph.py | .py | from ..Tensor import Tensor
from .binary_dilate_circle import binary_dilate_circle
from .binary_erode_circle import binary_erode_circle
from .gaussian_blur import gaussian_blur
from .pad import pad
from .cast import cast
def binary_morph(input_t : Tensor, erode_dilate : int, blur : float, fade_to_border : bool = False... | 46 | 1,488 |
DeepFaceLive | xlib/avecl/_internal/op/reshape.py | .py | from typing import Iterable
from ..Tensor import Tensor
from ..SCacheton import SCacheton
from ..info import ReshapeInfo
def reshape(input_t : Tensor, new_shape : Iterable, copy=True) -> Tensor:
"""
reshape operator
arguments
new_shape Iterable of ints
copy(True) if True, produ... | 27 | 704 |
DeepFaceLive | xlib/avecl/_internal/op/transpose.py | .py | import numpy as np
from ..AAxes import AAxes
from ..AShape import AShape
from ..backend import Kernel
from ..HKernel import HKernel
from ..info import TransposeInfo
from ..SCacheton import SCacheton
from ..Tensor import Tensor
def transpose(input_t : Tensor, axes_order, op_text=None, dtype : np.dtype = None, output_t... | 69 | 2,242 |
DeepFaceLive | xlib/avecl/_internal/op/any_wise.py | .py | import numpy as np
from ..AAxes import AAxes
from ..AShape import AShape
from ..backend import Kernel
from ..HArgs import HArgs
from ..HKernel import HKernel
from ..HType import HType
from ..info import BroadcastInfo, ReductionInfo
from ..SCacheton import SCacheton
from ..Tensor import Tensor
def any_wise(op_text : ... | 117 | 4,924 |
DeepFaceLive | xlib/avecl/_internal/op/cvt_color.py | .py | import numpy as np
from ..AShape import AShape
from ..backend import Kernel
from ..HKernel import HKernel
from ..SCacheton import SCacheton
from ..Tensor import Tensor
def cvt_color (input_t : Tensor, in_mode : str, out_mode : str, ch_axis=1, dtype=None):
"""
converts color
input_t Tensor (...,... | 243 | 9,579 |
DeepFaceLive | xlib/avecl/_internal/op/binary_erode_circle.py | .py | from ..AShape import AShape
from ..backend import Kernel
from ..HKernel import HKernel
from ..info import Conv2DInfo
from ..SCacheton import SCacheton
from ..Tensor import Tensor
def binary_erode_circle (input_t : Tensor, radius : int = 1, iterations : int = 1, dtype=None):
"""
Binary erode operator using cir... | 92 | 2,716 |
DeepFaceLive | xlib/avecl/_internal/op/remap.py | .py | import numpy as np
from ..AShape import AShape
from ..backend import Kernel
from ..HKernel import HKernel
from ..info import BroadcastInfo
from ..SCacheton import SCacheton
from ..Tensor import Tensor
def remap (input_t : Tensor, coords_t : Tensor, dtype=None) -> Tensor:
"""
remap input_t in spatial axes usin... | 104 | 3,831 |
DeepFaceLive | xlib/avecl/_internal/op/binary_dilate_circle.py | .py | from ..AShape import AShape
from ..backend import Kernel
from ..HKernel import HKernel
from ..info import Conv2DInfo
from ..SCacheton import SCacheton
from ..Tensor import Tensor
def binary_dilate_circle (input_t : Tensor, radius : int = 1, iterations : int = 1, dtype=None):
"""
Binary dilate operator using c... | 92 | 2,720 |
DeepFaceLive | xlib/avecl/_internal/op/cast.py | .py | from ..Tensor import Tensor
from .any_wise import any_wise
def cast(input_t : Tensor, dtype, output_t:Tensor=None) -> Tensor:
"""
cast operator
arguments
input_t
dtype
output_t compute result to this Tensor.
Tensor may be with different sha... | 18 | 430 |
DeepFaceLive | xlib/avecl/_internal/op/warp_affine.py | .py | import numpy as np
from ..AShape import AShape
from ..initializer import InitCoords2DArange
from ..SCacheton import SCacheton
from ..Tensor import Tensor
from .matmul import matmul
from .remap import remap
def warp_affine (input_t : Tensor, affine_t : Tensor, output_size=None, dtype=None) -> Tensor:
"""
argum... | 73 | 2,570 |
DeepFaceLive | xlib/avecl/_internal/op/tile.py | .py | import numpy as np
from typing import List
from ..AShape import AShape
from ..backend import Kernel
from ..HKernel import HKernel
from ..info import TileInfo
from ..SCacheton import SCacheton
from ..Tensor import Tensor
def tile(input_t : Tensor, tiles : List[int], dtype : np.dtype = None, output_t=None, is_add_to_ou... | 59 | 2,004 |
DeepFaceLive | xlib/avecl/_internal/op/slice_.py | .py | from typing import List
import numpy as np
from ..AShape import AShape
from ..AAxes import AAxes
from ..backend import Kernel
from ..HKernel import HKernel
from ..HType import HType
from ..info import SliceInfo
from ..SCacheton import SCacheton
from ..Tensor import Tensor
def split(input_t : Tensor, axis, keepdims=... | 94 | 2,943 |
DeepFaceLive | xlib/avecl/_internal/op/rct.py | .py | import numpy as np
from ..Tensor import Tensor
from .any_wise import any_wise, sqrt
from .concat import concat
from .cvt_color import cvt_color
from .slice_ import split
from .reduce import moments
def rct(target_t : Tensor, source_t : Tensor, target_mask_t : Tensor = None, source_mask_t : Tensor = None, mask_cutoff... | 59 | 2,125 |
DeepFaceLive | xlib/avecl/_internal/op/matmul.py | .py | import numpy as np
from ..AShape import AShape
from ..backend import Kernel
from ..HArgs import HArgs
from ..SCacheton import SCacheton
from ..Tensor import Tensor
def matmul(a_t : Tensor, b_t : Tensor, output_t: Tensor=None, is_add_to_output=False) -> Tensor:
"""
matmul operator in row-major format
A(... | 159 | 5,040 |
DeepFaceLive | xlib/avecl/_internal/op/pad.py | .py | from typing import List
import numpy as np
from ..HType import HType
from ..AShape import AShape
from ..backend import Kernel
from ..HKernel import HKernel
from ..info import PadInfo
from ..SCacheton import SCacheton
from ..Tensor import Tensor
def pad(input_t : Tensor, axes_paddings : List, mode : str = 'constant'... | 72 | 2,863 |
DeepFaceLive | xlib/avecl/_internal/op/concat.py | .py | from ..backend import Kernel
from ..HArgs import HArgs
from ..HType import HType
from ..HKernel import HKernel
from ..info import ConcatInfo
from ..SCacheton import SCacheton
from ..Tensor import Tensor
def concat(tensor_list, axis, dtype=None, output_t=None, is_add_to_output=False) -> Tensor:
"""
arguments
... | 70 | 2,469 |
DeepFaceLive | xlib/avecl/_internal/op/remap_np_affine.py | .py | import numpy as np
from ..AShape import AShape
from ..backend import Kernel
from ..EInterpolation import EInterpolation
from ..HKernel import HKernel
from ..SCacheton import SCacheton
from ..Tensor import Tensor
def remap_np_affine (input_t : Tensor, affine_n : np.ndarray, interpolation : EInterpolation = None, inve... | 235 | 7,810 |
DeepFaceLive | xlib/avecl/_internal/op/gaussian_blur.py | .py | import numpy as np
from ..Tensor import Tensor
from .depthwise_conv2D import depthwise_conv2D
def gaussian_blur (input_t : Tensor, sigma, dtype=None) -> Tensor:
"""
arguments
input_t Tensor(...,H,W)
sigma float
"""
if sigma <= 0.0:
return input_t.copy()
dev... | 40 | 1,101 |
DeepFaceLive | xlib/avecl/_internal/op/depthwise_conv2D.py | .py | import numpy as np
from ..AShape import AShape
from ..backend import Kernel
from ..HKernel import HKernel
from ..info import BroadcastInfo, Conv2DInfo
from ..SCacheton import SCacheton
from ..Tensor import Tensor
def depthwise_conv2D (input_t : Tensor, kernel_t : Tensor, stride=1, dilation=1, padding='same', dtype=N... | 108 | 3,567 |
DeepFaceLive | xlib/avecl/_internal/op/stack.py | .py | import numpy as np
from typing import List
from ..AShape import AShape
from ..backend import Kernel
from ..HArgs import HArgs
from ..HKernel import HKernel
from ..HType import HType
from ..info import StackInfo
from ..SCacheton import SCacheton
from ..Tensor import Tensor
def stack(tensor_list : List[Tensor], axis, d... | 75 | 2,669 |
DeepFaceLive | xlib/avecl/_internal/op/slice_set.py | .py | import numpy as np
from ..AShape import AShape
from ..backend import Kernel
from ..HKernel import HKernel
from ..HType import HType
from ..info import BroadcastInfo, SliceInfo
from ..SCacheton import SCacheton
from ..Tensor import Tensor
def slice_set(input_t : Tensor, slices, value) -> Tensor:
"""
arguments... | 74 | 2,580 |
DeepFaceLive | xlib/avecl/_internal/op/reduce.py | .py | import math
import numpy as np
from ..AAxes import AAxes
from ..AShape import AShape
from ..backend import Kernel
from ..HKernel import HKernel
from ..info import ReductionInfo, TransposeInfo
from ..SCacheton import SCacheton
from ..Tensor import Tensor
from .slice_ import slice_
from .transpose import transpose
from... | 213 | 7,473 |
DeepFaceLive | xlib/avecl/_internal/info/TransposeInfo.py | .py | from ..AShape import AShape
from ..AAxes import AAxes
class TransposeInfo:
"""
TransposeInfo
arguments
shape AShape
axes_order AAxes
errors during the construction:
ValueError
result
.o_shape AShape
.no_changes bool transpos... | 38 | 694 |
DeepFaceLive | xlib/avecl/_internal/info/SliceInfo.py | .py | import math
import numpy as np
from ..AShape import AShape
class SliceInfo:
__slots__ = ['o_shape', 'o_shape_kd', 'just_reshaped','axes_bes','axes_abs_bes']
def __init__(self, shape : AShape, slices):
"""
Slice info.
can raise ValueError,TypeError during the construction
ar... | 148 | 5,180 |
DeepFaceLive | xlib/avecl/_internal/info/ConcatInfo.py | .py | from ..AShape import AShape
class ConcatInfo:
__slots__ = ['o_shape', 'axis', 'axis_sizes', 'axis_offsets']
def __init__(self, shapes, axis):
"""
Concat info
arguments
shapes Iterable of shapes
errors during the construction:
... | 63 | 1,743 |
DeepFaceLive | xlib/avecl/_internal/info/ReshapeInfo.py | .py | from ..AShape import AShape
class ReshapeInfo:
"""
Reshape info.
can raise ValueError,TypeError during the construction
arguments
shape AShape
target_shape Iterable of ints
can be any len and contains only one '-1'
Example
shape (... | 44 | 1,193 |
DeepFaceLive | xlib/avecl/_internal/info/TileInfo.py | .py | import numpy as np
from ..AShape import AShape, AShape
class TileInfo:
"""
Tile info.
arguments
shape AShape
tiles Iterable of ints
errors during the construction:
ValueError
result:
.o_shape AShape
.axes_slices list of slice() to fetch origi... | 52 | 1,298 |
DeepFaceLive | xlib/avecl/_internal/info/PadInfo.py | .py | from typing import List
import numpy as np
from ..AShape import AShape
class PadInfo:
"""
Pad info.
arguments
shape AShape
axes_paddings list of (l_pad, r_pad)
if [0] == ... (Ellipsis), then left-side paddings will be filled with (0,0) for remain axes
... | 57 | 1,600 |
DeepFaceLive | xlib/avecl/_internal/info/StackInfo.py | .py | from ..AShape import AShape
class StackInfo:
__slots__ = ['o_shape', 'axis']
def __init__(self, shape, axis, stack_count):
"""
Stack info
arguments
shape AShape
axis Int
stack_count Int
errors during the construc... | 37 | 840 |
DeepFaceLive | xlib/avecl/_internal/info/BroadcastInfo.py | .py | from typing import List
import numpy as np
from ..AShape import AShape
from ..AAxes import AAxes
class BroadcastInfo:
"""
Broadcast info for multi shapes.
arguments
shapes List[AShape]
errors during the construction:
ValueError
Example:
shapes = ( 3,),
... | 75 | 2,530 |
DeepFaceLive | xlib/avecl/_internal/info/ReductionInfo.py | .py | from ..AShape import AShape
class ReductionInfo:
"""
Reduction info
arguments
shape AShape
axes AAxes
keepdims bool
can raise ValueError, TypeError during the construction
"""
__slots__ = [
'reduction_axes', # sorted reduction AAxes
... | 50 | 1,327 |
DeepFaceLive | xlib/avecl/_internal/info/Conv2DInfo.py | .py | from collections import Iterable
import math
class Conv2DInfo:
"""
Conv2DInfo
arguments
H, W int axes sizes
KH, KW int kernel sizes
stride int
dilation int
padding 'valid' no padding
'same' output size... | 79 | 2,340 |
DeepFaceLive | xlib/avecl/_internal/backend/DeviceInfo.py | .py | class DeviceInfo:
"""
Represents picklable OpenCL device info
"""
def __init__(self, index : int = None, name : str = None, total_memory : int = None, performance_level : int = None):
self._index = index
self._name = name
self._total_memory = total_memory
self._performan... | 45 | 1,287 |
DeepFaceLive | xlib/avecl/_internal/backend/Kernel.py | .py | class Kernel:
"""
TensorCL kernel.
It does not allocate any resources, thus can be used as static variable within class.
arguments
kernel_text OpenCL text of kernel. Must contain only one __kernel
global_shape default global_shape for .run()
local_shape default loc... | 27 | 834 |
DeepFaceLive | xlib/avecl/_internal/backend/Buffer.py | .py | from typing import Iterable, Union
import numpy as np
from . import OpenCL as CL
class Buffer:
__slots__ = ['_device','_cl_mem','_size','_on_initialize']
def __init__(self, device : 'Device', size : int, on_initialize = None):
"""
represents physical buffer associated with physical device
... | 111 | 3,906 |
DeepFaceLive | xlib/avecl/_internal/backend/__init__.py | .py | from .Buffer import Buffer
from .Device import (Device, cleanup_devices, get_available_devices_info,
get_best_device, get_default_device, get_device,
set_default_device)
from .DeviceInfo import DeviceInfo
from .Kernel import Kernel
| 7 | 274 |
DeepFaceLive | xlib/avecl/_internal/backend/Device.py | .py | import random
from collections import deque
from typing import List, Union
import numpy as np
from . import OpenCL as CL
from .Buffer import Buffer
from .DeviceInfo import DeviceInfo
from .Kernel import Kernel
_np_dtype_to_cl = { np.uint8: CL.cl_uchar,
np.int8: CL.cl_char,
... | 557 | 20,880 |
DeepFaceLive | xlib/avecl/_internal/backend/OpenCL/OpenCL.py | .py | """
Minimal OpenCL 1.2 low level ctypes API.
"""
import ctypes
from ctypes import POINTER, create_string_buffer, sizeof, c_char_p, c_char, c_size_t, c_void_p, byref
from ctypes.util import find_library
from enum import IntEnum
dlls_by_name = {}
def dll_import(dll_name):
dll = dlls_by_name.get(dll_name, None)
i... | 279 | 12,691 |
DeepFaceLive | xlib/avecl/_internal/backend/OpenCL/__init__.py | .py | """
Minimal OpenCL 1.2 low level ctypes API.
"""
from .OpenCL import (CL_DEVICE_EXTENSIONS, CL_DEVICE_GLOBAL_MEM_SIZE,
CL_DEVICE_MAX_COMPUTE_UNITS, CL_DEVICE_MAX_MEM_ALLOC_SIZE,
CL_DEVICE_MAX_WORK_GROUP_SIZE, CL_DEVICE_NAME,
CL_DEVICE_TYPE, CL_DEVICE_TYPE_A... | 38 | 2,387 |
DeepFaceLive | xlib/qt/widgets/QXSaveableComboBox.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from typing import Iterable
from .QXComboBox import QXComboBox
from .QXMainApplication import QXMainApplication
from ..core.widget import BlockSignals
class QXSaveableComboBox(QXComboBox):
def __init__(self, db_key, choices : ... | 48 | 1,564 |
DeepFaceLive | xlib/qt/widgets/_part_QXWidget.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ..core.widget import BlockSignals
from .QXMainApplication import QXMainApplication
_size_policy_from_str = {
'fixed' : QSizePolicy.Policy.Fixed,
'minimum' : QSizePolicy.Policy.Minimum,
'maximum' : QSizePolicy.Policy.Ma... | 138 | 4,532 |
DeepFaceLive | xlib/qt/widgets/QXSpinBox.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ._part_QXWidget import _part_QXWidget
class QXSpinBox(QSpinBox, _part_QXWidget):
def __init__(self, min=None,
max=None,
step=None,
special_value_text=None,
... | 48 | 1,704 |
DeepFaceLive | xlib/qt/widgets/QXHorizontalLine.py | .py | from PyQt6.QtWidgets import *
from .QXLabel import QXLabel
class QXHorizontalLine(QXLabel):
def __init__(self, thickness=1,
color=None):
super().__init__(size_policy=(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed),
fixed_size=(None,thickness) )
... | 14 | 404 |
DeepFaceLive | xlib/qt/widgets/QXRadioButton.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ._part_QXWidget import _part_QXWidget
class QXRadioButton(QRadioButton, _part_QXWidget):
def __init__(self, text=None,
disabled_color=None,
auto_exclusive=False,
... | 37 | 1,168 |
DeepFaceLive | xlib/qt/widgets/QXWidgetHBox.py | .py | from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from .QXWidget import QXWidget
from .QXHBoxLayout import QXHBoxLayout
class QXWidgetHBox(QXWidget):
def __init__(self, widgets=None, contents_margins=0, spacing=0, **kwargs):
super().__init__(layout=QXHBoxLayout(widgets=widgets, contents_margins=cont... | 10 | 362 |
DeepFaceLive | xlib/qt/widgets/QXPushButton.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ..core.QXTimeLine import QXTimeLine
from ..gui import QXImage, QXImageSequence
from ._part_QXWidget import _part_QXWidget
class QXPushButton(QPushButton, _part_QXWidget):
def __init__(self, image : QXImage = None, flat=False,... | 124 | 4,083 |
DeepFaceLive | xlib/qt/widgets/QXGridLayout.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ..core.widget import set_contents_margins
class QXGridLayout(QGridLayout):
def __init__(self, contents_margins=0, spacing=None, horizontal_spacing=None, vertical_spacing=None):
super().__init__()
set_contents_... | 22 | 621 |
DeepFaceLive | xlib/qt/widgets/QXVBoxLayout.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ..core.widget import set_contents_margins
class QXVBoxLayout(QVBoxLayout):
def __init__(self, widgets=None, contents_margins=0, spacing=0):
super().__init__()
set_contents_margins(self, contents_margins)
... | 32 | 1,111 |
DeepFaceLive | xlib/qt/widgets/QXToolButton.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ._part_QXWidget import _part_QXWidget
class QXToolButton(QToolButton, _part_QXWidget):
def __init__(self, text=None,
checkable=False,
checked=None,
toggled=... | 33 | 992 |
DeepFaceLive | xlib/qt/widgets/QXFrameVBox.py | .py | from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from .QXFrame import QXFrame
from .QXVBoxLayout import QXVBoxLayout
class QXFrameVBox(QXFrame):
def __init__(self, widgets=None, contents_margins=0, spacing=0, **kwargs):
super().__init__(layout=QXVBoxLayout(widgets=widgets, contents_margins=contents... | 10 | 358 |
DeepFaceLive | xlib/qt/widgets/QXWidget.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ._part_QXWidget import _part_QXWidget
class QXWidget(QWidget, _part_QXWidget):
def __init__(self, **kwargs):
"""
"""
super().__init__()
_part_QXWidget.__init__(self, **kwargs)
def focusInE... | 22 | 553 |
DeepFaceLive | xlib/qt/widgets/QXVerticalLine.py | .py | from PyQt6.QtWidgets import *
from .QXLabel import QXLabel
class QXVerticalLine(QXLabel):
def __init__(self, thickness=1, color=None):
super().__init__(size_policy=(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Expanding),
fixed_size=(thickness,None) )
if color is not None... | 12 | 385 |
DeepFaceLive | xlib/qt/widgets/QXWindow.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ...python import EventListener
from .forward_declarations import forward_declarations
from .QXMainApplication import QXMainApplication
from .QXWidget import QXWidget
class QXWindow(QXWidget):
def __init__(self, save_load_stat... | 96 | 3,009 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.