Exemplo n.º 1
0
    def batch_size(self, batch_size: int) -> None:
        if not isinstance(batch_size, int):
            raise e.TypeError("`batch_size` should be a integer")
        if batch_size <= 0:
            raise e.ValueError("`batch_size` should be greater than 0")

        self._batch_size = batch_size
Exemplo n.º 2
0
    def margin(self, margin: float) -> None:
        if not isinstance(margin, float):
            raise e.TypeError("`margin` should be a float")
        if margin <= 0:
            raise e.ValueError("`margin` should be greater than 0")

        self._margin = margin
Exemplo n.º 3
0
def test_type_error():
    new_exception = exception.TypeError("error")

    try:
        raise new_exception
    except exception.TypeError:
        pass
Exemplo n.º 4
0
    def normalize(self, normalize: Tuple[int, int]) -> None:
        if not (isinstance(normalize, tuple) or normalize is None):
            raise e.TypeError("`normalize` should be a tuple or None")

        self._normalize = normalize
Exemplo n.º 5
0
    def input_shape(self, input_shape: Tuple[int, ...]) -> None:
        if not (isinstance(input_shape, tuple) or input_shape is None):
            raise e.TypeError("`input_shape` should be a tuple or None")

        self._input_shape = input_shape
Exemplo n.º 6
0
    def shuffle(self, shuffle: bool) -> None:
        if not isinstance(shuffle, bool):
            raise e.TypeError("`shuffle` should be a boolean")

        self._shuffle = shuffle
Exemplo n.º 7
0
    def batches(self, batches: tf.data.Dataset) -> None:
        if not isinstance(batches, tf.data.Dataset):
            raise e.TypeError("`batches` should be a tf.data.Dataset")

        self._batches = batches
Exemplo n.º 8
0
    def n_pairs(self, n_pairs: int) -> None:
        if not isinstance(n_pairs, int):
            raise e.TypeError("`n_pairs` should be a integer")

        self._n_pairs = n_pairs
Exemplo n.º 9
0
    def soft(self, soft: bool) -> None:
        if not isinstance(soft, bool):
            raise e.TypeError("`soft` should be a boolean")

        self._soft = soft
Exemplo n.º 10
0
    def B(self, B: Base) -> None:
        if not isinstance(B, Base):
            raise e.TypeError("`B` should be a child from Base class")

        self._B = B