MCPcopy
hub / github.com/GPflow/GPflow / set_default_float

Function set_default_float

gpflow/config/__config__.py:285–298  ·  view source on GitHub ↗

Sets default float type. Available options are `np.float16`, `np.float32`, or `np.float64`.

(value_type: type)

Source from the content-addressed store, hash-verified

283
284
285def set_default_float(value_type: type) -> None:
286 """
287 Sets default float type. Available options are `np.float16`, `np.float32`,
288 or `np.float64`.
289 """
290 try:
291 tf_dtype = tf.as_dtype(value_type) # Test that it's a tensorflow-valid dtype
292 except TypeError:
293 raise TypeError(f"{value_type} is not a valid tf or np dtype")
294
295 if not tf_dtype.is_floating:
296 raise TypeError(f"{value_type} is not a float dtype")
297
298 set_config(replace(config(), float=tf_dtype.as_numpy_dtype))
299
300
301def set_default_jitter(value: float) -> None:

Callers 2

test_v_prior_dtypesFunction · 0.90
GPLVM.pct.pyFile · 0.90

Calls 2

set_configFunction · 0.85
configFunction · 0.85

Tested by 1

test_v_prior_dtypesFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…