[math] Fix NumPy unsupported native padding modes
@@ -151,7 +151,8 @@ class NumPyBackend(Backend):
return np.arange(start, limit, delta, to_numpy_dtype(dtype))
def pad(self, value, pad_width, mode='constant', constant_values=0):
- assert mode in ('constant', 'symmetric', 'periodic', 'reflect', 'boundary'), mode
+ if mode not in ('constant', 'symmetric', 'periodic', 'reflect', 'boundary'):
+ return NotImplemented
if mode == 'constant':
return np.pad(value, pad_width, 'constant', constant_values=constant_values)
else:
