1
0
Fork 0
mirror of https://github.com/deepfakes/faceswap synced 2025-06-09 04:36:50 -04:00
faceswap/lib/plaidml_utils.py

18 lines
640 B
Python

'''
Multiple plaidml implementation.
'''
import plaidml
def pad(data, paddings, mode="CONSTANT", name=None, constant_value=0):
""" PlaidML Pad """
# TODO: use / impl other padding method when required
# CONSTANT -> SpatialPadding ? | Doesn't support first and last axis +
# no support for constant_value
# SYMMETRIC -> Requires impl ?
if mode.upper() != "REFLECT":
raise NotImplementedError("pad only supports mode == 'REFLECT'")
if constant_value != 0:
raise NotImplementedError("pad does not support constant_value != 0")
return plaidml.op.reflection_padding(data, paddings)