Skip to content

Commit

Permalink
add parameter check to random_uniform_initializer (#3316)
Browse files Browse the repository at this point in the history
Former-commit-id: 29e6c25
  • Loading branch information
Ldpe2G authored Jul 28, 2020
1 parent ed432d6 commit ea1e638
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions oneflow/python/ops/initializer_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def random_uniform_initializer(
Returns:
An InitializerConf object.
"""
assert minval <= maxval
initializer = op_conf_util.InitializerConf()
if dtype in [dtype_util.float, dtype_util.double]:
setattr(initializer.random_uniform_conf, "min", float(minval))
Expand Down
2 changes: 1 addition & 1 deletion oneflow/python/test/ops/test_slice_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def slice(input_blob: oft.Numpy.Placeholder(shape=(2, 5, 4), dtype=flow.float)):
x = flow.get_variable(
shape=(2, 5, 4),
dtype=flow.float,
initializer=flow.random_uniform_initializer(0, 1),
initializer=flow.random_uniform_initializer(0, 2),
name="variable",
)
x = flow.identity(x)
Expand Down

0 comments on commit ea1e638

Please sign in to comment.