Source code for deephyper.core.exceptions.nas.space
from deephyper.core.exceptions.nas import NASError
[docs]class WrongSequenceToSetOperations(NASError):
"""Raised when a sequence of actions is not of the same lenght as the number of variable nodes of the search_space."""
def __init__(self, sequence_given, sequence_valid):
self.sequence_given = sequence_given
self.sequence_valid = sequence_valid
def __str__(self):
return f"Wrong sequence given: '{self.sequence_given}' of length {len(self.sequence_given)} when a valid sequence should be of length {len(self.sequence_valid)}"
[docs]class StructureHasACycle(NASError):
"""Raised when a search_space is containing a cycle."""
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
[docs]class NodeAlreadyAdded(NASError):
"""Raised when a node has already been added in a search_space."""
def __init__(self, node):
self.node = node
def __str__(self):
return (
f"The node '{str(self.node)}' has already been added to the search_space."
)
[docs]class WrongOutputShape(NASError):
"""Raised when the output shape of the model generated by a search_space doesn't
match the expected shape.
"""
def __init__(self, tensor_shape, expected_shape):
self.tensor_shape = tensor_shape
self.expected_shape = expected_shape
def __str__(self):
return f"The output tensor of shape {self.tensor_shape} doesn't match the expected shape {self.expected_shape}!"