You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: deepinv/physics/generator/base.py
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,15 @@ def __init__(
73
73
device
74
74
), f"The random generator is not on the same device as the Physics Generator. Got random generator on {rng.device} and the Physics Generator named {self.__class__.__name__} on {self.device}."
75
75
self.rng=rng
76
+
77
+
# NOTE: There is no use in moving RNG states from one device to another
78
+
# as Generator.set_state only supports inputs living on the CPU. Yet,
79
+
# by registering the initial random state as a buffer, it might be
80
+
# moved to another device. This might hinder performance as the tensor
81
+
# will need to be moved back to the CPU if it needs to be used later.
82
+
# We could fix that by letting it be a regular class attribute instead
83
+
# of a buffer but it would prevent it from being included in the
0 commit comments