mirror of
https://github.com/wassname/ray.git
synced 2026-08-12 12:20:11 +08:00
[RLlib] Minimal ParamNoise PR. (#7772)
This commit is contained in:
@@ -134,7 +134,12 @@ def get_variable(value, framework="tf", tf_name="unnamed-variable"):
|
||||
"""
|
||||
if framework == "tf":
|
||||
import tensorflow as tf
|
||||
return tf.compat.v1.get_variable(tf_name, initializer=value)
|
||||
dtype = getattr(
|
||||
value, "dtype", tf.float32
|
||||
if isinstance(value, float) else tf.int32
|
||||
if isinstance(value, int) else None)
|
||||
return tf.compat.v1.get_variable(
|
||||
tf_name, initializer=value, dtype=dtype)
|
||||
# torch or None: Return python primitive.
|
||||
return value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user