Esempio n. 1
0
 def __init__(self, shape_x, begin, end, strides):
     super(Net, self).__init__()
     self.strided_slice_grad = G.StridedSliceGrad()
     self.shape_x = shape_x
     self.begin = begin
     self.end = end
     self.strides = strides
Esempio n. 2
0
 def __init__(self, x, begin, end, stride):
     super(StridedSliceGrad, self).__init__()
     self.shape_op = P.Shape()
     self.shapex = self.shape_op(x)
     self.begin = begin
     self.end = end
     self.stride = stride
     self.stride_slice = G.StridedSliceGrad()
Esempio n. 3
0
     'skip': ['backward']}),
 ('StridedSlice', {
     'block': P.StridedSlice(),
     'desc_const': [(0, 1, 2, 1),
               (2, 3, 3, 4),
               (1, 1, 1, 1)],
     'desc_inputs': [[2, 3, 3, 5]],
     'desc_bprop': [[2, 2, 1, 3]]}),
 ('Slice_1', {
     'block': P.Slice(),
     'desc_const': [(0, 1, 2, 1),
                     (1, 1, 1, 2)],
     'desc_inputs': [[2, 3, 3, 5]],
     'desc_bprop': [[1, 1, 1, 2]]}),
 ('StridedSliceGrad', {
     'block': G.StridedSliceGrad(),
     'desc_const': [(64, 1, 1024),
               (0, 1, 0),
               (64, 2, 1024),
               (1, 1, 1)],
     'desc_inputs': [[64, 128, 1024]],
     'skip': ['backward']}),
 ('RandomChoiceWithMask', {
     'block': P.RandomChoiceWithMask(256),
     'desc_inputs': [Tensor(np.random.rand(24000, 4).astype(np.bool_))],
     'desc_bprop': [[256,4], [256,4]],
     'skip': ['backward']}),
 ('LessEqual', {
     'block': P.LessEqual(),
     'desc_inputs': [Tensor(np.random.rand(4).astype(np.float16)),
                     Tensor(np.random.rand(4).astype(np.float16))],
import mindspore as ms
import mindspore.common.dtype as mstype
from mindspore.common.tensor import Tensor

make_tuple = Primitive('make_tuple')
reshape = P.Reshape()
backend_reshape = Primitive('Reshape')
cast = P.Cast()
backend_cast = Primitive('Cast')
transpose = P.Transpose()
backend_transpose = Primitive('Transpose')
onehot1 = P.OneHot()
onehot2 = P.OneHot()
backend_onehot1 = Primitive('OneHot')
backend_onehot2 = Primitive('OneHot')
stridedslicegrad = G.StridedSliceGrad()
backend_stridedslicegrad = Primitive('StridedSliceGrad')
on_value = Tensor(1.0, mstype.float32)
off_value = Tensor(0.0, mstype.float32)
depth = Tensor(2, mstype.int32)
shape = (2, 4, 2, 2)
dropout_gen_mask = P.DropoutGenMask()


class FnDict:
    def __init__(self):
        self.fnDict = {}

    def __call__(self, fn):
        self.fnDict[fn.__name__] = fn
Esempio n. 5
0
 def __init__(self):
     super(StridedSliceGrad2, self).__init__()
     self.ssg = G.StridedSliceGrad()
     self.shape = P.Shape()