Esempio n. 1
0
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)
Esempio n. 2
0
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)
Esempio n. 3
0
 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)])
Esempio n. 4
0
 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)])
Esempio n. 5
0
 def get_layer_groups(self, precompute):
     lgs = list(split_by_idxs(children(self.model.rn), [self.lr_cut]))
     return lgs + [children(self.model)[1:]]