gpflow.experimental.check_shapes.argument_ref#
Code for (de)referencing arguments.
Classes#
gpflow.experimental.check_shapes.argument_ref.AllElementsRef#
- class gpflow.experimental.check_shapes.argument_ref.AllElementsRef(source)[source]#
Bases:
DelegatingArgumentRef
A reference to all elements in a collection.
- Parameters:
source (
ArgumentRef
) –
- map_value(value, context)[source]#
Map this value, from self.source to new value(s).
- Parameters:
value (
Any
) –context (
ErrorContext
) –
- Return type:
Iterable
[Tuple
[Any
,ErrorContext
]]
gpflow.experimental.check_shapes.argument_ref.ArgumentRef#
- class gpflow.experimental.check_shapes.argument_ref.ArgumentRef[source]#
Bases:
ABC
A reference to an argument.
- abstract get(arg_map, context)[source]#
Get the value(s) of this argument from the given argument map.
- Parameters:
arg_map (
Mapping
[str
,Any
]) –context (
ErrorContext
) –
- Return type:
Sequence
[Tuple
[Any
,ErrorContext
]]
- abstract property is_result: bool#
Whether this is a reference to the function result.
- Return type:
bool
- abstract property root_argument_name: str#
Name of the argument this reference eventually starts from.
Returns RESULT_TOKEN if this in an argument to the function result.
- Return type:
str
gpflow.experimental.check_shapes.argument_ref.AttributeArgumentRef#
- class gpflow.experimental.check_shapes.argument_ref.AttributeArgumentRef(source, attribute_name)[source]#
Bases:
DelegatingArgumentRef
A reference to an attribute on an argument.
- Parameters:
source (
ArgumentRef
) –attribute_name (
str
) –
- map_context(context)[source]#
Pre-map this error context from self.source.
The mapped value will both be used for error messages and passed to map_value above.
- Parameters:
context (
ErrorContext
) –- Return type:
- map_value(value, context)[source]#
Map this value, from self.source to new value(s).
- Parameters:
value (
Any
) –context (
ErrorContext
) –
- Return type:
Iterable
[Tuple
[Any
,ErrorContext
]]
gpflow.experimental.check_shapes.argument_ref.DelegatingArgumentRef#
- class gpflow.experimental.check_shapes.argument_ref.DelegatingArgumentRef(source)[source]#
Bases:
ArgumentRef
Abstract base class for
ArgumentRef
s that delegates to a source.- Parameters:
source (
ArgumentRef
) –
- get(arg_map, context)[source]#
Get the value(s) of this argument from the given argument map.
- Parameters:
arg_map (
Mapping
[str
,Any
]) –context (
ErrorContext
) –
- Return type:
Sequence
[Tuple
[Any
,ErrorContext
]]
- property is_result: bool#
Whether this is a reference to the function result.
- Return type:
bool
- map_context(context)[source]#
Pre-map this error context from self.source.
The mapped value will both be used for error messages and passed to map_value above.
- Parameters:
context (
ErrorContext
) –- Return type:
- abstract map_value(value, context)[source]#
Map this value, from self.source to new value(s).
- Parameters:
value (
Any
) –context (
ErrorContext
) –
- Return type:
Iterable
[Tuple
[Any
,ErrorContext
]]
- property root_argument_name: str#
Name of the argument this reference eventually starts from.
Returns RESULT_TOKEN if this in an argument to the function result.
- Return type:
str
gpflow.experimental.check_shapes.argument_ref.IndexArgumentRef#
- class gpflow.experimental.check_shapes.argument_ref.IndexArgumentRef(source, index)[source]#
Bases:
DelegatingArgumentRef
A reference to an element in a list.
- Parameters:
source (
ArgumentRef
) –index (
int
) –
- map_context(context)[source]#
Pre-map this error context from self.source.
The mapped value will both be used for error messages and passed to map_value above.
- Parameters:
context (
ErrorContext
) –- Return type:
- map_value(value, context)[source]#
Map this value, from self.source to new value(s).
- Parameters:
value (
Any
) –context (
ErrorContext
) –
- Return type:
Iterable
[Tuple
[Any
,ErrorContext
]]
gpflow.experimental.check_shapes.argument_ref.KeysRef#
- class gpflow.experimental.check_shapes.argument_ref.KeysRef(source)[source]#
Bases:
DelegatingArgumentRef
A reference to all keys of a mapping.
- Parameters:
source (
ArgumentRef
) –
- map_value(value, context)[source]#
Map this value, from self.source to new value(s).
- Parameters:
value (
Any
) –context (
ErrorContext
) –
- Return type:
Iterable
[Tuple
[Any
,ErrorContext
]]
gpflow.experimental.check_shapes.argument_ref.RootArgumentRef#
- class gpflow.experimental.check_shapes.argument_ref.RootArgumentRef(argument_name)[source]#
Bases:
ArgumentRef
A reference to a single argument.
- Parameters:
argument_name (
str
) –
- get(arg_map, context)[source]#
Get the value(s) of this argument from the given argument map.
- Parameters:
arg_map (
Mapping
[str
,Any
]) –context (
ErrorContext
) –
- Return type:
Sequence
[Tuple
[Any
,ErrorContext
]]
- property is_result: bool#
Whether this is a reference to the function result.
- Return type:
bool
- property root_argument_name: str#
Name of the argument this reference eventually starts from.
Returns RESULT_TOKEN if this in an argument to the function result.
- Return type:
str
gpflow.experimental.check_shapes.argument_ref.ValuesRef#
- class gpflow.experimental.check_shapes.argument_ref.ValuesRef(source)[source]#
Bases:
DelegatingArgumentRef
A reference to all values of a mapping.
- Parameters:
source (
ArgumentRef
) –
- map_value(value, context)[source]#
Map this value, from self.source to new value(s).
- Parameters:
value (
Any
) –context (
ErrorContext
) –
- Return type:
Iterable
[Tuple
[Any
,ErrorContext
]]