def test_blocks_Fisher_Q(): model, filters_info = build_model() f_u = build_f_u(model, filters_info) X_U = np.random.ranf( (1, 3, 32, 32)) # test only with 1 for memory consumption query = blocks_Fisher_Q(X_U, f_u) import pdb pdb.set_trace()
def test_blocks_Fisher_P(): model, filters_info = build_model() f_u = build_f_u(model, filters_info) f_l = build_f_l(model, filters_info) X_U = np.random.ranf((50, 1, 28, 28)) X_L = np.random.ranf((100, 1, 28, 28)) Y_L = np.asarray([np.random.randint(10) for i in range(100)]).reshape( (100, 1)) blocks_Fisher_P(X_L, Y_L, X_U, f_l, f_u, 50)
def test_kfac_unlabelled(): X = np.random.ranf((12, 3, 32, 32)) model, filters_info = build_model() f = build_f_u(model, filters_info) kfac_unlabelled(X, f)
def test_build_f_u(): model, filters_info = build_model() f = build_f_u(model, filters_info) x_value = np.random.ranf((100, 3, 32, 32)) dico = f(x_value)
def test_kfac_query(): model, filters_info = build_model() f_u = build_f_u(model, filters_info) X = np.random.ranf((10, 3, 32, 32)) batch_size = len(X) kfac_query(X, f_u, batch_size)