Esempio n. 1
0
 def func(op1, op2):
     op = op1(op2)
     assert_is_instance(op, ZeroOperator)
     attr = {}
     attr.update(op2.attrout)
     attr.update(op1.attrout)
     assert_equal(op.attrout, attr)
     x = np.ones(3)
     y = ndarraywrap(4)
     op(x, y)
     y2_tmp = np.empty(4)
     y2 = np.empty(4)
     op2(x, y2_tmp)
     op1(y2_tmp, y2)
     assert_equal(y, y2)
     assert_is_instance(y, op1.classout)
Esempio n. 2
0
 def func(op, op1, op2, op_ref):
     assert_is_instance(op, type(op_ref))
     attr = {}
     attr.update(op2.attrout)
     attr.update(op1.attrout)
     assert_equal(op.attrout, attr)
     x = np.ones(op.shapein if op.shapein is not None else 3)
     y = ndarraywrap(4)
     op(x, y)
     if op1.flags.shape_output == 'unconstrained' or \
        op2.flags.shape_output == 'unconstrained':
         y2_tmp = np.empty(3 if isinstance(op2, IdentityOperator) else 4)
         y2 = np.empty(4)
         op2(x, y2_tmp)
         op1(y2_tmp, y2)
     else:
         y2 = op1(op2(x))
     assert_equal(y, y2)
     assert_is_instance(y, op1.classout)