facebookresearch / fvcore

Collection of common code that's shared among different research projects in FAIR computer vision team.
Apache License 2.0
1.93k stars 226 forks source link

baddbmm not supported #117

Open rwightman opened 1 year ago

rwightman commented 1 year ago

As per title, baddbmm is not supported and is quite common

Can submit PR with below unless any issues/concerns...

def baddbmm_flop_jit(inputs: List[Any], outputs: List[Any]) -> Number:
    """
    Count flops for fully connected layers.
    """
    input_shapes = [get_shape(v) for v in inputs[1:3]]
    n, c, t = input_shapes[0]
    d = input_shapes[-1][-1]
    flop = n * c * t * d
    return flop