示例#1
0
def init_param():
    sz1_i, sz1_o = 784, 512
    theta1 = [shared(tmp, borrow=True)
              for tmp in params_init.for_matrix(sz1_i, sz1_o, rng=rng)]
    sz2_i, sz2_o = 512, 256
    theta2 = [shared(tmp, borrow=True)
              for tmp in params_init.for_matrix(sz2_i, sz2_o, rng=rng)]
    sz3_i, sz3_o = 256, 10
    theta3 = [shared(tmp, borrow=True)
              for tmp in params_init.for_matrix(sz3_i, sz3_o, rng=rng)]
    return theta1 + theta2 + theta3
def init_param():
    sz1_i, sz1_o = (1, 5, 5), (16,)
    sz1_pool = (2, 2)
    theta1 = [shared(tmp, borrow=True) for tmp in params_init.for_conv(sz1_i, sz1_o, sz1_pool, rng=rng)]

    sz2_i, sz2_o = (16, 5, 5), (16,)
    sz2_pool = (2, 2)
    theta2 = [shared(tmp, borrow=True) for tmp in params_init.for_conv(sz2_i, sz2_o, sz2_pool, rng=rng)]

    sz3_i, sz3_o = 256, 128
    theta3 = [shared(tmp, borrow=True) for tmp in params_init.for_matrix(sz3_i, sz3_o, rng=rng)]

    sz4_i, sz4_o = 128, 10
    theta4 = [shared(tmp, borrow=True) for tmp in params_init.for_matrix(sz4_i, sz4_o, rng=rng)]
    return theta1 + theta2 + theta3 + theta4