gpflow.experimental.check_shapes.decorator#
Decorator for checking the shapes of function using tf Tensors.
Classes#
gpflow.experimental.check_shapes.decorator.ConditionContext#
- class gpflow.experimental.check_shapes.decorator.ConditionContext(condition)[source]#
Bases:
gpflow.experimental.check_shapes.error_contexts.ErrorContext
An error occurred in a conditional context.
- Parameters
condition (
ParsedBoolSpec
) –
- print(builder)[source]#
Print this context to the given MessageBuilder.
- Parameters
builder (
MessageBuilder
) –- Return type
None
gpflow.experimental.check_shapes.decorator.FunctionDefinitionContext#
- class gpflow.experimental.check_shapes.decorator.FunctionDefinitionContext(func)[source]#
Bases:
gpflow.experimental.check_shapes.error_contexts.ErrorContext
An error occured in the context of a function definition.
- Parameters
func (
Callable
[...
,Any
]) –
- print(builder)[source]#
Print this context to the given MessageBuilder.
- Parameters
builder (
MessageBuilder
) –- Return type
None
gpflow.experimental.check_shapes.decorator.ParsedArgumentSpec#
- class gpflow.experimental.check_shapes.decorator.ParsedArgumentSpec(argument_ref, tensor, condition)[source]#
Bases:
object
- Parameters
argument_ref (
ArgumentRef
) –tensor (
ParsedTensorSpec
) –condition (
Optional
[ParsedBoolSpec
]) –
Functions#
gpflow.experimental.check_shapes.decorator.null_check_shapes#
- gpflow.experimental.check_shapes.decorator.null_check_shapes(func)[source]#
Annotates the given function so that it looks like it has shape checks, but without actually checking anything.
This is necessary not to break
@inherit_check_shapes
when shape checking is disabled.- Parameters
func (
TypeVar
(C
, bound=Callable
[...
,Any
])) –- Return type
TypeVar
(C
, bound=Callable
[...
,Any
])
gpflow.experimental.check_shapes.decorator.parse_and_rewrite_docstring#
- gpflow.experimental.check_shapes.decorator.parse_and_rewrite_docstring(docstring, function_spec, context)[source]#
Rewrite docstring to include the shapes specified by the argument_specs.
- Parameters
docstring (
Optional
[str
]) –function_spec (
ParsedFunctionSpec
) –context (
ErrorContext
) –
- Return type
Optional
[str
]
gpflow.experimental.check_shapes.decorator.parse_function_spec#
- gpflow.experimental.check_shapes.decorator.parse_function_spec(function_spec, context)[source]#
Parse all check_shapes argument or note specification for a single function.
- Parameters
function_spec (
Sequence
[str
]) –context (
ErrorContext
) –
- Return type