Ejemplo n.º 1
0
 def __init__(self, drop_connect_rate=0., seed0=0, seed1=0):
     super(DropConnect, self).__init__()
     self.shape = P.Shape()
     self.dtype = P.DType()
     self.keep_prob = 1 - drop_connect_rate
     self.dropout = P.Dropout(keep_prob=self.keep_prob)
     self.keep_prob_tensor = Tensor(self.keep_prob, dtype=mstype.float32)
Ejemplo n.º 2
0
 def __init__(self, keep_prob=0.5, dtype=mstype.float32):
     super(Dropout, self).__init__()
     if keep_prob <= 0 or keep_prob > 1:
         raise ValueError("dropout probability should be a number in range (0, 1], but got {}".format(keep_prob))
     Validator.check_subclass("dtype", dtype, mstype.number_type, self.cls_name)
     Validator.check_value_type('keep_prob', keep_prob, [float], self.cls_name)
     self.keep_prob = keep_prob
     seed0, seed1 = _get_graph_seed(0, "dropout")
     self.seed0 = seed0
     self.seed1 = seed1
     self.dropout = P.Dropout(keep_prob, seed0, seed1)
Ejemplo n.º 3
0
    def __init__(self, keep_prob=0.5, seed0=0, seed1=0, dtype=mstype.float32):
        super(Dropout, self).__init__()
        if keep_prob <= 0 or keep_prob > 1:
            raise ValueError("dropout probability should be a number in range (0, 1], but got {}".format(keep_prob))
        validator.check_subclass("dtype", dtype, mstype.number_type, self.cls_name)
        self.keep_prob = keep_prob
        self.seed0 = seed0
        self.seed1 = seed1
        self.dtype = dtype
        self.get_shape = P.Shape()
        self.dropout_gen_mask = P.DropoutGenMask(Seed0=seed0, Seed1=seed1)
        self.dropout_do_mask = P.DropoutDoMask()
        self.cast = P.Cast()
        self.is_gpu = context.get_context('device_target') in ["GPU"]

        if self.is_gpu:
            self.dropout = P.Dropout(keep_prob)
Ejemplo n.º 4
0
 def __init__(self, strategy1=None, strategy2=None):
     super().__init__()
     self.dropout = P.Dropout(keep_prob=0.6).set_strategy(strategy1)
     self.matmul = P.MatMul().set_strategy(strategy2)
Ejemplo n.º 5
0
 def __init__(self, keep_prob):
     super(Net, self).__init__()
     self.drop = P.Dropout(keep_prob)
Ejemplo n.º 6
0
 def __init__(self):
     super(Net2, self).__init__()
     self.dropout = P.Dropout(keep_prob=1.0)
Ejemplo n.º 7
0
 def __init__(self):
     super(Net, self).__init__()
     self.dropout = P.Dropout()
Ejemplo n.º 8
0
 def __init__(self, keep_prob):
     super(DropoutDynamic, self).__init__()
     self.test_dynamic = inner.GpuConvertToDynamicShape()
     self.drop = P.Dropout(keep_prob)