예제 #1
0
        'desc_bprop': [[1, 1, 1]]}),
    ('Sum_6', {
        'block': P.ReduceSum(),
        'desc_const': [()],
        'desc_inputs': [[2, 3, 4]],
        'desc_bprop': [[1]]}),
    ('Sign', {
        'block': P.Sign(),
        'desc_inputs': [[3]],
        'desc_bprop': [[3]]}),
    ('Round', {
        'block': P.Round(),
        'desc_inputs': [[3]],
        'desc_bprop': [[3]]}),
    ('Atan2', {
        'block': P.Atan2(),
        'desc_inputs': [Tensor(np.array([0, 1]).astype(np.float32)),
                        Tensor(np.array([1, 1]).astype(np.float32))],
        'desc_bprop': [[2]]})
]

test_case_nn_ops = [
    ('BiasAdd', {
        'block': P.BiasAdd(),
        'desc_inputs': [[1, 3, 3, 3], [3]],
        'desc_bprop': [[1, 3, 3, 3]]}),
    ('BiasAddGrad', {
        'block': G.BiasAddGrad(),
        'desc_inputs': [[1, 3, 3, 3]],
        'skip': ['backward']}),
    ('Gelu', {
예제 #2
0
        'skip': ['backward']}),

    # input is not tensor
    ('Round0', {
        'block': (P.Round(), {'exception': TypeError, 'error_keywords': ['Round']}),
        'desc_inputs': [5.0],
        'skip': ['backward']}),
    # input is Tensor(bool)
    ('Round1', {
        'block': (P.Round(), {'exception': TypeError, 'error_keywords': ['Round']}),
        'desc_inputs': [Tensor(np.ones([3, 4]).astype(np.bool_))],
        'skip': ['backward']}),

    # one input is scalar, and another is Tensor(float32)
    ('Atan20', {
        'block': (P.Atan2(), {'exception': TypeError, 'error_keywords': ['Atan2']}),
        'desc_inputs': [5.0, Tensor(np.ones([3, 4]).astype(np.float32))],
        'skip': ['backward']}),
    # input two tensors, but element types are not same
    ('Atan21', {
        'block': (P.Atan2(), {'exception': TypeError, 'error_keywords': ['Atan2']}),
        'desc_inputs': [Tensor(np.ones([3, 4]).astype(np.int32)), Tensor(np.ones([3, 4]).astype(np.float32))],
        'skip': ['backward']}),
    # input two tensors, their shapes do not match
    ('Atan22', {
        'block': (P.Atan2(), {'exception': ValueError, 'error_keywords': ['Atan2']}),
        'desc_inputs': [Tensor(np.ones([3, 5]).astype(np.float32)), Tensor(np.ones([3, 4]).astype(np.float32))],
        'skip': ['backward']}),
]

예제 #3
0
        'desc_inputs': [5.0],
        'skip': ['backward']
    }),
    # input is Tensor(bool)
    ('Round1', {
        'block': (P.Round(), {
            'exception': TypeError,
            'error_keywords': ['Round']
        }),
        'desc_inputs': [Tensor(np.ones([3, 4]).astype(np.bool_))],
        'skip': ['backward']
    }),

    # input two tensors, their shapes do not match
    ('Atan22', {
        'block': (P.Atan2(), {
            'exception': ValueError,
            'error_keywords': ['Atan2']
        }),
        'desc_inputs': [
            Tensor(np.ones([3, 5]).astype(np.float32)),
            Tensor(np.ones([3, 4]).astype(np.float32))
        ],
        'skip': ['backward']
    }),
]

test_case_math_ops = [
    # input two tensors, but element types are not same
    ('TensorAdd1', {
        'block':
예제 #4
0
 def __init__(self, strategy1, strategy2):
     super().__init__()
     self.matmul = P.MatMul().shard(strategy1)
     self.atan2 = P.Atan2().shard(strategy2)
예제 #5
0
        'desc_const': [()],
        'desc_inputs': [[2, 3, 4]],
        'desc_bprop': [[1]]
    }), ('Sign', {
        'block': P.Sign(),
        'desc_inputs': [[3]],
        'desc_bprop': [[3]]
    }),
    ('Round', {
        'block': P.Round(),
        'desc_inputs': [[3]],
        'desc_bprop': [[3]]
    }),
    ('Atan2', {
        'block':
        P.Atan2(),
        'desc_inputs': [
            Tensor(np.array([0, 1]).astype(np.float32)),
            Tensor(np.array([1, 1]).astype(np.float32))
        ],
        'desc_bprop': [[2]]
    })
]

test_case_nn_ops = [
    ('BiasAdd', {
        'block': P.BiasAdd(),
        'desc_inputs': [[1, 3, 3, 3], [3]],
        'desc_bprop': [[1, 3, 3, 3]]
    }),
    ('BiasAddGrad', {
예제 #6
0
 def __init__(self):
     super(NetAtan2, self).__init__()
     self.atan2 = P.Atan2()