!6618 move set_seed() out from construct() of Net
Merge pull request !6618 from yihuaijie/seed
This commit is contained in:
commit
0c6f1a663c
|
@ -22,7 +22,7 @@ from mindspore.ops import composite as C
|
|||
from mindspore.common import set_seed
|
||||
|
||||
context.set_context(mode=context.GRAPH_MODE, device_target="Ascend")
|
||||
|
||||
set_seed(20)
|
||||
|
||||
class Net(nn.Cell):
|
||||
def __init__(self, shape, seed=0):
|
||||
|
@ -31,7 +31,6 @@ class Net(nn.Cell):
|
|||
self.seed = seed
|
||||
|
||||
def construct(self, alpha, beta):
|
||||
set_seed(20)
|
||||
return C.gamma(self.shape, alpha, beta, self.seed)
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ from mindspore.ops import composite as C
|
|||
from mindspore.common import set_seed
|
||||
|
||||
context.set_context(mode=context.GRAPH_MODE, device_target="Ascend")
|
||||
|
||||
set_seed(20)
|
||||
|
||||
class Net(nn.Cell):
|
||||
def __init__(self, shape, seed=0):
|
||||
|
@ -31,7 +31,6 @@ class Net(nn.Cell):
|
|||
self.seed = seed
|
||||
|
||||
def construct(self, mean, stddev):
|
||||
set_seed(20)
|
||||
return C.normal(self.shape, mean, stddev, self.seed)
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ from mindspore.ops import composite as C
|
|||
from mindspore.common import set_seed
|
||||
|
||||
context.set_context(mode=context.GRAPH_MODE, device_target="Ascend")
|
||||
|
||||
set_seed(20)
|
||||
|
||||
class Net(nn.Cell):
|
||||
def __init__(self, shape, seed=0):
|
||||
|
@ -31,7 +31,6 @@ class Net(nn.Cell):
|
|||
self.seed = seed
|
||||
|
||||
def construct(self, mean):
|
||||
set_seed(20)
|
||||
return C.poisson(self.shape, mean, self.seed)
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ from mindspore.ops import composite as C
|
|||
from mindspore.common import set_seed
|
||||
|
||||
context.set_context(mode=context.GRAPH_MODE, device_target="Ascend")
|
||||
|
||||
set_seed(20)
|
||||
|
||||
class Net(nn.Cell):
|
||||
def __init__(self, shape, seed=0):
|
||||
|
@ -31,7 +31,6 @@ class Net(nn.Cell):
|
|||
self.seed = seed
|
||||
|
||||
def construct(self, minval, maxval):
|
||||
set_seed(20)
|
||||
return C.uniform(self.shape, minval, maxval, self.seed)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue