Esempio n. 1
0
    def __init__(self, src_type=mstype.float32, dst_type=mstype.float32):
        super(SaturateCast, self).__init__()
        np_type = mstype.dtype_to_nptype(dst_type)

        self.tensor_min_type = float(np.finfo(np_type).min)
        self.tensor_max_type = float(np.finfo(np_type).max)

        self.min_op = P.Minimum()
        self.max_op = P.Maximum()
        self.cast = P.Cast()
        self.dst_type = dst_type
Esempio n. 2
0
    def __init__(self, src_type=mstype.float32, dst_type=mstype.float32):
        super(SaturateCast, self).__init__()
        np_type = mstype.dtype_to_nptype(dst_type)
        min_type = np.finfo(np_type).min
        max_type = np.finfo(np_type).max

        self.tensor_min_type = Tensor([min_type], dtype=src_type)
        self.tensor_max_type = Tensor([max_type], dtype=src_type)

        self.min_op = ops.Minimum()
        self.max_op = ops.Maximum()
        self.cast = ops.Cast()
        self.dst_type = dst_type
Esempio n. 3
0
 def __init__(self):
     super(ClipByValue, self).__init__()
     self.min = ops.Minimum()
     self.max = ops.Maximum()
Esempio n. 4
0
 def __init__(self, min_val=-1.0, max_val=1.0):
     super().__init__()
     self.min_val = min_val
     self.max_val = max_val
     self.max = ops.Maximum()
     self.min = ops.Minimum()
Esempio n. 5
0
 def __init__(self, alpha=1.0):
     super().__init__()
     self.alpha = alpha
     self.exp = ops.Exp()
     self.max = ops.Maximum()
     self, min = ops.Minimum()