def __init__(self, channel=1, w=0.25, strategy_=None, strategy1_=None):
     super(PReLU, self).__init__()
     self.add = P.TensorAdd(strategy=strategy1_)
     self.prelu = P.PReLU(strategy=strategy_)
示例#2
0
 def __init__(self, strategy):
     super().__init__()
     self.prelu = P.PReLU().set_strategy(strategy)
示例#3
0
 def __init__(self):
     super().__init__()
     self.prelu = P.PReLU()
示例#4
0
 def __init__(self):
     super(PReLUNet, self).__init__()
     self.prelu = P.PReLU()
     self.w = Tensor(np.ones(3, np.float32))
示例#5
0
     'desc_inputs': [[4, 128, 1024]],
     'desc_bprop': [[4, 128, 1024]]}),
 ('ReLU', {
     'block': P.ReLU(),
     'desc_inputs': [[64, 64, 112, 112]],
     'desc_bprop': [[64, 64, 112, 112]]}),
 ('SeqConvBnRelu', {
     'block': SeqConvBnRelu(3, 64),
     'desc_inputs': [[64, 3, 112, 112]],
     'desc_bprop': [[64, 64, 112, 112]]}),
 ('PReluCell', {
     'block': nn.PReLU(1, [np.float32(0.25)]),
     'desc_inputs': [[128, 64, 112, 112]],
     'desc_bprop': [[128, 64, 112, 112]]}),
 ('PRelu', {
     'block': P.PReLU(),
     'desc_inputs': [[128, 64, 112, 112], [64,]],
     'desc_bprop': [[128, 64, 112, 112]]}),
 ('Cos', {
     'block': P.Cos(),
     'desc_inputs': [[8, 16]],
     'desc_bprop': [[8, 16]]}),
 ('ACos', {
     'block': P.ACos(),
     'desc_inputs': [[8, 16]],
     'desc_bprop': [[8, 16]]}),
 ('Exp', {
     'block': P.Exp(),
     'desc_inputs': [[256, 8]],
     'desc_bprop': [[256, 8]]}),
 ('Pow', {
示例#6
0
 def __init__(self, strategy1, strategy2):
     super().__init__()
     self.matmul = P.MatMul().set_strategy(strategy1)
     self.prelu = P.PReLU().set_strategy(strategy2)
示例#7
0
 def __init__(self):
     super(NetPReLU, self).__init__()
     self.prelu = P.PReLU()
示例#8
0
    ('ScatterNdUpdate', {
        'block': (P.ScatterNdUpdate(), {
            'exception': TypeError
        }),
        'desc_inputs': (Tensor(np.ones(
            (2, 3), np.float32)), Tensor(np.ones(
                (2, 2), np.int32)), Tensor(np.ones((2, ), np.float32))),
        'desc_bprop': [[2, 3]]
    }),
    ('Pack', {
        'block': (NetForPackInput(P.Pack()), {
            'exception': ValueError
        }),
        'desc_inputs': [[2, 2]],
        'desc_bprop': [[1, 2, 2]]
    }),
    ('PReLU', {
        'block': (P.PReLU(), {
            'exception': ValueError
        }),
        'desc_inputs': [[2], [1]],
        'desc_bprop': [[1]]
    }),
]


@mindspore_test(
    pipeline_for_compile_forward_ge_graph_for_case_by_case_config_exception)
def test_check_exception():
    return raise_set
示例#9
0
 def __init__(self, channel=1, w=0.25, strategy1=None, strategy2=None):
     super().__init__()
     self.norm = P.L2Normalize().shard(strategy1)
     self.prelu = P.PReLU().shard(strategy2)
     self.w = Parameter(initializer(w, [channel,]), name='w')
示例#10
0
 def __init__(self, channel=1, w=0.25):
     super().__init__()
     self.norm = P.L2Normalize(axis=1)
     self.prelu = P.PReLU()
     self.w = Parameter(initializer(w, [channel,]), name='w')
示例#11
0
        'desc_bprop': [[2, 3, 3, 5]]}),
    ('Shape_error', {
        'block': (P.Shape(), {'exception': TypeError}),
        'desc_inputs': [(64, 1)],
        'desc_bprop': [[64]]}),
    ('Flatten_Error', {
        'block': (NetForFlatten0D(), {'exception': ValueError}),
        'desc_inputs': [Tensor(np.array(0).astype(np.int32))],
        'desc_bprop': [Tensor(np.array(0).astype(np.int32))]}),
    ('ScatterNdUpdate', {
        'block': (P.ScatterNdUpdate(), {'exception': TypeError}),
        'desc_inputs': (Tensor(np.ones((2, 3), np.float32)),
                        Tensor(np.ones((2, 2), np.int32)),
                        Tensor(np.ones((2,), np.float32))),
        'desc_bprop': [[2, 3]]}),
    ('Pack', {
        'block': (NetForPackInput(P.Pack()), {'exception': ValueError}),
        'desc_inputs': [[2, 2]],
        'desc_bprop': [[1, 2, 2]]}),
    ('PReLU', {
        'block': (P.PReLU(), {'exception': ValueError}),
        'desc_inputs': [[2], [1]],
        'desc_bprop': [[1]]}),

]


@mindspore_test(pipeline_for_compile_forward_ge_graph_for_case_by_case_config_exception)
def test_check_exception():
    return raise_set