Example #1
0
def compute_dz1_db1(h):
    '''
        Compute local gradient of the logits function z2 w.r.t. the biases b2. 
        Input:
            h: the number of output activations in the first layer, an integer. 
        Output:
            dz1_db1: the partial gradient of the logits z1 w.r.t. the biases b1, a float vector of shape h by 1. 
                   Each element represents the partial gradient of the i-th logit z1[i] w.r.t. the i-th bias b1[i]:  d_z1[i] / d_b1[i]
    '''
    dz1_db1 = sr.compute_dz_db(h)
    return dz1_db1
Example #2
0
def compute_dz2_db2(c):
    '''
        Compute local gradient of the logits function z2 w.r.t. the biases b2. 
        Input:
            c: the number of classes, an integer. 
        Output:
            dz2_db2: the partial gradient of the logits z2 w.r.t. the biases b2, a float vector of shape c by 1. 
                   Each element represents the partial gradient of the i-th logit z2[i] w.r.t. the i-th bias b2[i]:  d_z2[i] / d_b2[i]
    '''
    dz2_db2 = sr.compute_dz_db(c)
    return dz2_db2