示例#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
示例#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
示例#3
0
def test_type_error():
    new_exception = exception.TypeError("error")

    try:
        raise new_exception
    except exception.TypeError:
        pass
示例#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
示例#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
示例#6
0
    def shuffle(self, shuffle: bool) -> None:
        if not isinstance(shuffle, bool):
            raise e.TypeError("`shuffle` should be a boolean")

        self._shuffle = shuffle
示例#7
0
文件: pair.py 项目: gugarosa/dualing
    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
示例#8
0
文件: pair.py 项目: gugarosa/dualing
    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
示例#9
0
    def soft(self, soft: bool) -> None:
        if not isinstance(soft, bool):
            raise e.TypeError("`soft` should be a boolean")

        self._soft = soft
示例#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