def eval_spec(spec, environment=None): """Evaluates a spec and returns the environment. This function allows you to use a spec to obtain multiple bindings in an environment. That is useful if you use the spec language to specify multiple components of a larger network, for example: "left = Cr(64, [5,5]); right = Fc(64)" Usually, you will want to use `create_net` or `create_net_fun` below. Args: spec: specification as a string environment: a dictionary of input bindings Returns: Environment with additional bindings created by spec. Raises: Exception: other exceptions raised during execution of `spec` """ specs_lib.check_keywords(spec) bindings = {} if environment: bindings.update(environment) exec_(spec, vars(specs_ops), bindings) # pylint: disable=exec-used return bindings
def eval_spec(spec, environment=None): """Evaluates a spec and returns the environment. This function allows you to use a spec to obtain multiple bindings in an environment. That is useful if you use the spec language to specify multiple components of a larger network, for example: "left = Cr(64, [5,5]); right = Fc(64)" Usually, you will want to use `create_net` or `create_net_fun` below. Args: spec: specification as a string environment: a dictionary of input bindings Returns: Environment with additional bindings created by spec. Raises: Exception: other exceptions raised during execution of `spec` """ specs_lib.check_keywords(spec) bindings = {} if environment: bindings.update(environment) exec_(spec, vars(specs_ops), bindings) # pylint: disable=exec-used return bindings
def eval_params(params, environment=None): """Evaluates a parameter specification and returns the environment. Args: params: parameter assignments as a string environment: a dictionary of input bindings Returns: Environment with additional bindings created by executing `params` Raises: Exception: other exceptions raised during execution of `params` """ specs_lib.check_keywords(params) bindings = {} if environment: bindings.update(environment) exec_(params, vars(params_ops), bindings) # pylint: disable=exec-used return bindings
def eval_params(params, environment=None): """Evaluates a parameter specification and returns the environment. Args: params: parameter assignments as a string environment: a dictionary of input bindings Returns: Environment with additional bindings created by executing `params` Raises: Exception: other exceptions raised during execution of `params` """ specs_lib.check_keywords(params) bindings = {} if environment: bindings.update(environment) exec_(params, vars(params_ops), bindings) # pylint: disable=exec-used return bindings