python - Is there a `ufunc` that just forwards the data? -
is there ufunc
forwards data?
it's not difficult achieve same effect in cases, when explicitly working ufuncs, convenient have 1 forwards data. testing/debugging , have consistently looking code.
for example, when have function takes ufunc argument:
op = ufunc x = do_with_op(data0, data1, op)
if data real, np.conj(x)
, complex conjugate, identity unary ufunc.
you can create own ufuncs np.frompyfunc
:
forward_unary = np.frompyfunc(lambda x: x, 1, 1) forward_first = np.frompyfunc(lambda x, y: x, 2, 1) forward_second = np.frompyfunc(lambda x, y: y, 2, 1)
Comments
Post a Comment