We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9494856 commit c90c4d3Copy full SHA for c90c4d3
colabdesign/shared/utils.py
@@ -19,7 +19,10 @@ def clear_mem():
19
for obj_name in dir(module):
20
obj = getattr(module, obj_name)
21
if hasattr(obj, "cache_clear"):
22
- obj.cache_clear()
+ try:
23
+ obj.cache_clear()
24
+ except:
25
+ pass
26
gc.collect()
27
28
def update_dict(D, *args, **kwargs):
@@ -105,4 +108,4 @@ def softmax(x, axis=-1):
105
108
return x / x.sum(axis,keepdims=True)
106
109
107
110
def categorical(p):
- return (p.cumsum(-1) >= np.random.uniform(size=p.shape[:-1])[..., None]).argmax(-1)
111
+ return (p.cumsum(-1) >= np.random.uniform(size=p.shape[:-1])[..., None]).argmax(-1)
0 commit comments