def METHOD_NAME(cls, ctx, op):
    (in_chunk,), device_id, xp = as_same_device(
        [ctx[c.key] for c in op.inputs], device=op.device, ret_extra=True
    )
    axis = cls.get_axis(op.axis)
    with device(device_id):
        chunk_count = numel(
            in_chunk, axis=axis, dtype=np.int64, keepdims=bool(op.keepdims)
        )
        chunk_sum = xp.sum(
            in_chunk, axis=axis, dtype=op.dtype, keepdims=bool(op.keepdims)
        )
        ctx[op.outputs[0].key] = (chunk_sum, chunk_count)