def test_split_by_idxs_error_handling(): seq = [1,2,3,4] idxs = [5] gen = split_by_idxs(seq, idxs) with pytest.raises(KeyError): next(gen)
def test_split_by_idxs_error_handling(): seq = [1,2,3,4] idxs = [5] gen = core.split_by_idxs(seq, idxs) with pytest.raises(KeyError): next(gen)
def test_split_by_idxs(seq, idxs, ex): test_result = [] for item in split_by_idxs(seq, idxs): test_result.append(item) assert len(test_result) == len(ex) assert all([a == b for a,b in zip(test_result, ex)])
def test_split_by_idxs(seq, idxs, ex): test_result = [] for item in core.split_by_idxs(seq, idxs): test_result.append(item) assert len(test_result) == len(ex) assert all([a == b for a,b in zip(test_result, ex)])
def get_layer_groups(self, precompute): lgs = list(split_by_idxs(children(self.model.rn), [self.lr_cut])) return lgs + [children(self.model)[1:]]