inferpy.util package¶
Submodules¶
inferpy.util.common module¶
Obtained from Keras GitHub repository: https://github.com/keras-team/keras/blob/master/keras/backend/common.py
inferpy.util.interceptor module¶
-
inferpy.util.interceptor.
set_values
(**model_kwargs)[source]¶ Creates a value-setting interceptor. Usable as a parameter of the ed2.interceptor.
- Model_kwargs:
The name of each argument must be the name of a random variable to intercept, and the value is the element which intercepts the value of the random variable.
- Returns:
The random variable with the intercepted value
-
inferpy.util.interceptor.
set_values_condition
(var_condition, var_value)[source]¶ Creates a value-setting interceptor. Usable as a parameter of the ed2.interceptor.
- Var_condition (tf.Variable)tf.Variable):
The boolean tf.Variable, used to intercept the value property with value_var or the variable value property itself
- Var_value (tf.Variable)tf.Variable):
The tf.Variable used to intercept the value property when var_condition is True
- Returns:
The random variable with the intercepted value
inferpy.util.iterables module¶
-
inferpy.util.iterables.
get_shape
(x)[source]¶ Get the shape of an element x. If it is an element with a shape attribute, return it. If it is a list with more than one element, compute the shape by checking the len, and the shape of internal elements. In that case, the shape must be consistent. Finally, in other case return () as shape.
- Parameters:
x – The element to compute its shape
- Raises:
class `ValueError` – list shape not consistent
- Returns:
A tuple with the shape of x
inferpy.util.name module¶
inferpy.util.runtime module¶
Module focused on evaluating tensors to makes the usage easier, forgetting about tensors and sessions
-
inferpy.util.runtime.
tf_run_allowed
(f)[source]¶ A function might return a tensor or not. In order to decide if the result of this function needs to be evaluated in a tf session or not, use the tf_run extra parameter or the tf_run_default value. If True, and this function is in the first level of execution depth, use a tf Session to evaluate the tensor or other evaluable object (like dicts)
inferpy.util.session module¶
inferpy.util.startup module¶
inferpy.util.tf_graph module¶
Module contents¶
Package with modules defining functions, classes and variables which are useful for the main functionality provided by inferpy
-
inferpy.util.
floatx
()[source]¶ Returns the default float type, as a string. (e.g. float16, float32, float64).
- Returns:
the current default float type.
- Return type:
String
Example
>>> inf.floatx() 'float32'
-
inferpy.util.
set_floatx
(floatx)[source]¶ Sets the default float type.
- Parameters:
floatx – String, ‘float16’, ‘float32’, or ‘float64’.
Example
>>> from keras import backend as K >>> inf.floatx() 'float32' >>> inf.set_floatx('float16') >>> inf..floatx() 'float16'
-
inferpy.util.
tf_run_allowed
(f)[source]¶ A function might return a tensor or not. In order to decide if the result of this function needs to be evaluated in a tf session or not, use the tf_run extra parameter or the tf_run_default value. If True, and this function is in the first level of execution depth, use a tf Session to evaluate the tensor or other evaluable object (like dicts)