(z, y, x)
return rotMat
[summary] Converts euler angles to rotation matrix
    Reference: https://github.com/pulkitag/pycaffe-utils/blob/master/rot_utils.py#L174
     TODO: remove the dimension for 'N' (deprecated for converting all source
           poses altogether)
    
    Arguments:
        z: rotation angle along z axis (in radians) -- size = [B, N]
        y: rotation angle along y axis (in radians) -- size = [B, N]
        x: rotation angle along x axis (in radians) -- size = [B, N]
    
    Returns:
        Rotation matrix corresponding to the euler angles -- size = [B, N, 3, 3]
[summary] Converts euler angles to rotation matrix
    Reference: https://github.com/pulkitag/pycaffe-utils/blob/master/rot_utils.py#L174
     TODO: remove the dimension for 'N' (deprecated for converting all source
           poses altogether)
    
    Arguments:
        z: rotation angle along z axis (in radians) -- size = [B, N]
        y: rotation angle along y axis (in radians) -- size = [B, N]
        x: rotation angle along x axis (in radians) -- size = [B, N]
    
    Returns:
        Rotation matrix corresponding to the euler angles -- size = [B, N, 3, 3]
[ summary ] Converts euler angles to rotation matrix Reference : https : // github . com / pulkitag / pycaffe - utils / blob / master / rot_utils . py#L174 TODO : remove the dimension for N ( deprecated for converting all source poses altogether ) Arguments : z : rotation angle along z axis ( in radians ) -- size = [ B N ] y : rotation angle along y axis ( in radians ) -- size = [ B N ] x : rotation angle along x axis ( in radians ) -- size = [ B N ] Returns : Rotation matrix corresponding to the euler angles -- size = [ B N 3 3 ]
def euler2mat(z, y, x):
    """[summary] Converts euler angles to rotation matrix
    Reference: https://github.com/pulkitag/pycaffe-utils/blob/master/rot_utils.py#L174
     TODO: remove the dimension for 'N' (deprecated for converting all source
           poses altogether)
    
    Arguments:
        z: rotation angle along z axis (in radians) -- size = [B, N]
        y: rotation angle along y axis (in radians) -- size = [B, N]
        x: rotation angle along x axis (in radians) -- size = [B, N]
    
    Returns:
        Rotation matrix corresponding to the euler angles -- size = [B, N, 3, 3]
    """

    B = tf.shape(z)[0]
    N = 1
    z = tf.clip_by_value(z, -np.pi, np.pi)
    y = tf.clip_by_value(y, -np.pi, np.pi)
    x = tf.clip_by_value(x, -np.pi, np.pi)

    # Expand to B x N x 1 x 1
    z = tf.expand_dims(tf.expand_dims(z, -1), -1)
    y = tf.expand_dims(tf.expand_dims(y, -1), -1)
    x = tf.expand_dims(tf.expand_dims(x, -1), -1)

    zeros = tf.zeros([B, N, 1, 1])
    ones = tf.ones([B, N, 1, 1])

    cosz = tf.cos(z)
    sinz = tf.sin(z)
    rotz_1 = tf.concat([cosz, -sinz, zeros], axis=3)
    rotz_2 = tf.concat([sinz,  cosz, zeros], axis=3)
    rotz_3 = tf.concat([zeros, zeros, ones], axis=3)
    zmat = tf.concat([rotz_1, rotz_2, rotz_3], axis=2)

    cosy = tf.cos(y)
    siny = tf.sin(y)
    roty_1 = tf.concat([cosy, zeros, siny], axis=3)
    roty_2 = tf.concat([zeros, ones, zeros], axis=3)
    roty_3 = tf.concat([-siny, zeros, cosy], axis=3)
    ymat = tf.concat([roty_1, roty_2, roty_3], axis=2)

    cosx = tf.cos(x)
    sinx = tf.sin(x)
    rotx_1 = tf.concat([ones, zeros, zeros], axis=3)
    rotx_2 = tf.concat([zeros, cosx, -sinx], axis=3)
    rotx_3 = tf.concat([zeros, sinx, cosx], axis=3)
    xmat = tf.concat([rotx_1, rotx_2, rotx_3], axis=2)

    rotMat = tf.matmul(tf.matmul(xmat, ymat), zmat)
    return rotMat
def euler2mat ( z , y , x ) : B = tf . shape ( z ) [ 0 ] N = 1 z = tf . clip_by_value ( z , - np . pi , np . pi ) y = tf . clip_by_value ( y , - np . pi , np . pi ) x = tf . clip_by_value ( x , - np . pi , np . pi ) # Expand to B x N x 1 x 1 z = tf . expand_dims ( tf . expand_dims ( z , - 1 ) , - 1 ) y = tf . expand_dims ( tf . expand_dims ( y , - 1 ) , - 1 ) x = tf . expand_dims ( tf . expand_dims ( x , - 1 ) , - 1 ) zeros = tf . zeros ( [ B , N , 1 , 1 ] ) ones = tf . ones ( [ B , N , 1 , 1 ] ) cosz = tf . cos ( z ) sinz = tf . sin ( z ) rotz_1 = tf . concat ( [ cosz , - sinz , zeros ] , axis = 3 ) rotz_2 = tf . concat ( [ sinz , cosz , zeros ] , axis = 3 ) rotz_3 = tf . concat ( [ zeros , zeros , ones ] , axis = 3 ) zmat = tf . concat ( [ rotz_1 , rotz_2 , rotz_3 ] , axis = 2 ) cosy = tf . cos ( y ) siny = tf . sin ( y ) roty_1 = tf . concat ( [ cosy , zeros , siny ] , axis = 3 ) roty_2 = tf . concat ( [ zeros , ones , zeros ] , axis = 3 ) roty_3 = tf . concat ( [ - siny , zeros , cosy ] , axis = 3 ) ymat = tf . concat ( [ roty_1 , roty_2 , roty_3 ] , axis = 2 ) cosx = tf . cos ( x ) sinx = tf . sin ( x ) rotx_1 = tf . concat ( [ ones , zeros , zeros ] , axis = 3 ) rotx_2 = tf . concat ( [ zeros , cosx , - sinx ] , axis = 3 ) rotx_3 = tf . concat ( [ zeros , sinx , cosx ] , axis = 3 ) xmat = tf . concat ( [ rotx_1 , rotx_2 , rotx_3 ] , axis = 2 ) rotMat = tf . matmul ( tf . matmul ( xmat , ymat ) , zmat ) return rotMat