def count_flops_attn(model, _x, y):
    '\n    A counter for the `thop` package to count the operations in an\n    attention operation.\n    Meant to be used like:\n        macs, params = thop.profile(\n            model,\n            inputs=(inputs, timestamps),\n            custom_ops={QKVAttention: QKVAttention.count_flops},\n        )\n    '
    (b, c, *spatial) = y[0].shape
    num_spatial = int(np.prod(spatial))
    matmul_ops = (((2 * b) * (num_spatial ** 2)) * c)
    model.total_ops += th.DoubleTensor([matmul_ops])
A counter for the `thop` package to count the operations in an
attention operation.
Meant to be used like:
    macs, params = thop.profile(
        model,
        inputs=(inputs, timestamps),
        custom_ops={QKVAttention: QKVAttention.count_flops},
    )
def count_flops_attn(model, _x, y):
    '\n    A counter for the `thop` package to count the operations in an\n    attention operation.\n    Meant to be used like:\n        macs, params = thop.profile(\n            model,\n            inputs=(inputs, timestamps),\n            custom_ops={QKVAttention: QKVAttention.count_flops},\n        )\n    '
    (b, c, *spatial) = y[0].shape
    num_spatial = int(np.prod(spatial))
    matmul_ops = (((2 * b) * (num_spatial ** 2)) * c)
    model.total_ops += th.DoubleTensor([matmul_ops])