@@ -324,66 +324,6 @@ def clone(self):
324324 return self .__class__ ()
325325
326326
327- def set (
328- mode : modes .Mode = None ,
329- dt : float = None ,
330- x64 : bool = None ,
331- complex_ : type = None ,
332- float_ : type = None ,
333- int_ : type = None ,
334- bool_ : type = None ,
335- ):
336- """Set the default computation environment.
337-
338- Parameters
339- ----------
340- mode: Mode
341- The computing mode.
342- dt: float
343- The numerical integration precision.
344- x64: bool
345- Enable x64 computation.
346- complex_: type
347- The complex data type.
348- float_
349- The floating data type.
350- int_
351- The integer data type.
352- bool_
353- The bool data type.
354- """
355- if dt is not None :
356- assert isinstance (dt , float ), '"dt" must a float.'
357- set_dt (dt )
358-
359- if mode is not None :
360- assert isinstance (mode , modes .Mode ), f'"mode" must a { modes .Mode } .'
361- set_mode (mode )
362-
363- if x64 is not None :
364- assert isinstance (x64 , bool ), f'"x64" must be a bool.'
365- set_x64 (x64 )
366-
367- if float_ is not None :
368- assert isinstance (float_ , type ), '"float_" must a float.'
369- set_float (float_ )
370-
371- if int_ is not None :
372- assert isinstance (int_ , type ), '"int_" must a type.'
373- set_int (int_ )
374-
375- if bool_ is not None :
376- assert isinstance (bool_ , type ), '"bool_" must a type.'
377- set_bool (bool_ )
378-
379- if complex_ is not None :
380- assert isinstance (complex_ , type ), '"complex_" must a type.'
381- set_complex (complex_ )
382-
383-
384- set_environment = set
385-
386-
387327class environment (_DecoratorContextManager ):
388328 r"""Context-manager that sets a computing environment for brain dynamics computation.
389329
@@ -541,6 +481,66 @@ def __init__(
541481 mode = modes .BatchingMode (batch_size ))
542482
543483
484+ def set (
485+ mode : modes .Mode = None ,
486+ dt : float = None ,
487+ x64 : bool = None ,
488+ complex_ : type = None ,
489+ float_ : type = None ,
490+ int_ : type = None ,
491+ bool_ : type = None ,
492+ ):
493+ """Set the default computation environment.
494+
495+ Parameters
496+ ----------
497+ mode: Mode
498+ The computing mode.
499+ dt: float
500+ The numerical integration precision.
501+ x64: bool
502+ Enable x64 computation.
503+ complex_: type
504+ The complex data type.
505+ float_
506+ The floating data type.
507+ int_
508+ The integer data type.
509+ bool_
510+ The bool data type.
511+ """
512+ if dt is not None :
513+ assert isinstance (dt , float ), '"dt" must a float.'
514+ set_dt (dt )
515+
516+ if mode is not None :
517+ assert isinstance (mode , modes .Mode ), f'"mode" must a { modes .Mode } .'
518+ set_mode (mode )
519+
520+ if x64 is not None :
521+ assert isinstance (x64 , bool ), f'"x64" must be a bool.'
522+ set_x64 (x64 )
523+
524+ if float_ is not None :
525+ assert isinstance (float_ , type ), '"float_" must a float.'
526+ set_float (float_ )
527+
528+ if int_ is not None :
529+ assert isinstance (int_ , type ), '"int_" must a type.'
530+ set_int (int_ )
531+
532+ if bool_ is not None :
533+ assert isinstance (bool_ , type ), '"bool_" must a type.'
534+ set_bool (bool_ )
535+
536+ if complex_ is not None :
537+ assert isinstance (complex_ , type ), '"complex_" must a type.'
538+ set_complex (complex_ )
539+
540+
541+ set_environment = set
542+
543+
544544def enable_x64 ():
545545 config .update ("jax_enable_x64" , True )
546546 set_int (jnp .int64 )
0 commit comments