def to_caffe(tfW, name=None, shape=None, color_layer='', conv_fc_transitionals=None, info=DummyDict()):
    assert conv_fc_transitionals is None or name is not None
    if tfW.ndim == 4:
        if (name == 'conv1_1' or name == 'conv1' or name == color_layer) and tfW.shape[2] == 3:
            tfW = tfW[:, :, ::-1]
            info[name] = 'flipped'
        cfW = tfW.transpose(3, 2, 0, 1)
        return cfW
    else:
        if conv_fc_transitionals is not None and name in conv_fc_transitionals:
            cf_shape = conv_fc_transitionals[name]
            tf_shape = (cf_shape[2], cf_shape[3], cf_shape[1], cf_shape[0])
            cfW = tfW.reshape(tf_shape).transpose(3, 2, 0, 1).reshape(cf_shape[0], -1)
            info[name] = 'fc->c transitioned with caffe shape {}'.format(cf_shape)
            return cfW
        else:
            return tfW.T