<commit_before>set(LOCAL_DETECTION_LIBS)

function(detection_library TARGET_NAME)
  set(oneValueArgs "")
  set(multiValueArgs SRCS DEPS)
  set(options "")
  set(common_deps op_registry)
  set(pybind_flag 0)
  cmake_parse_arguments(detection_library "${options}" "${oneValueArgs}"
                        "${multiValueArgs}" ${ARGN})
  set(srcs)
  # filter cuda source file when not build with cuda/rocm
  foreach(src ${detection_library_SRCS})
    if(NOT WITH_GPU AND NOT WITH_ROCM)
      if(${src} MATCHES ".*\\.cc$")
        list(APPEND srcs ${src})
      endif()
    else()
      list(APPEND srcs ${src})
    endif()
  endforeach()

  op_library(${TARGET_NAME} SRCS ${srcs} DEPS ${common_deps}
             ${detection_library_DEPS})

  set(LOCAL_DETECTION_LIBS
      ${TARGET_NAME} ${LOCAL_DETECTION_LIBS}
      PARENT_SCOPE)
endfunction()

if(WITH_ASCEND_CL)
  detection_library(box_coder_op SRCS box_coder_op.cc box_coder_op_npu.cc)
  detection_library(density_prior_box_op SRCS density_prior_box_op.cc
                    density_prior_box_op.cu density_prior_box_op_npu.cc)
else()
  detection_library(box_coder_op SRCS box_coder_op.cc)
  detection_library(density_prior_box_op SRCS density_prior_box_op.cc
                    density_prior_box_op.cu)
endif()

if(WITH_XPU)
  detection_library(iou_similarity_op SRCS iou_similarity_op.cc
                    iou_similarity_op_xpu.cc)
  detection_library(prior_box_op SRCS prior_box_op.cc)
  detection_library(generate_proposals_v2_op SRCS generate_proposals_v2_op.cc)
elseif(WITH_MLU)
  detection_library(iou_similarity_op SRCS iou_similarity_op.cc
                    iou_similarity_op_mlu.cc)
  detection_library(prior_box_op SRCS prior_box_op.cc prior_box_op_mlu.cc)
  detection_library(yolo_box_op SRCS yolo_box_op.cc yolo_box_op_mlu.cc)
elseif(WITH_ASCEND_CL)
  detection_library(iou_similarity_op SRCS iou_similarity_op.cc
                    iou_similarity_op_npu.cc)
  detection_library(prior_box_op SRCS prior_box_op.cc prior_box_op_npu.cc)
else()
  detection_library(iou_similarity_op SRCS iou_similarity_op.cc
                    iou_similarity_op.cu)
  detection_library(prior_box_op SRCS prior_box_op.cc)
  detection_library(yolo_box_op SRCS yolo_box_op.cc)
  # detection_library(generate_proposals_v2_op SRCS generate_proposals_v2_op.cc)
endif()

detection_library(bipartite_match_op SRCS bipartite_match_op.cc)
detection_library(mine_hard_examples_op SRCS mine_hard_examples_op.cc)
detection_library(anchor_generator_op SRCS anchor_generator_op.cc
                  anchor_generator_op.cu)
detection_library(target_assign_op SRCS target_assign_op.cc target_assign_op.cu)
detection_library(polygon_box_transform_op SRCS polygon_box_transform_op.cc
                  polygon_box_transform_op.cu)
detection_library(rpn_target_assign_op SRCS rpn_target_assign_op.cc)
detection_library(generate_proposal_labels_op SRCS
                  generate_proposal_labels_op.cc)
detection_library(multiclass_nms_op SRCS multiclass_nms_op.cc DEPS gpc)
detection_library(locality_aware_nms_op SRCS locality_aware_nms_op.cc DEPS gpc)
detection_library(matrix_nms_op SRCS matrix_nms_op.cc DEPS gpc)
detection_library(box_clip_op SRCS box_clip_op.cc box_clip_op.cu)<commit_msg>[MLU] fix cmake error (#46772)<commit_after>set(LOCAL_DETECTION_LIBS)

function(detection_library TARGET_NAME)
  set(oneValueArgs "")
  set(multiValueArgs SRCS DEPS)
  set(options "")
  set(common_deps op_registry)
  set(pybind_flag 0)
  cmake_parse_arguments(detection_library "${options}" "${oneValueArgs}"
                        "${multiValueArgs}" ${ARGN})
  set(srcs)
  # filter cuda source file when not build with cuda/rocm
  foreach(src ${detection_library_SRCS})
    if(NOT WITH_GPU AND NOT WITH_ROCM)
      if(${src} MATCHES ".*\\.cc$")
        list(APPEND srcs ${src})
      endif()
    else()
      list(APPEND srcs ${src})
    endif()
  endforeach()

  op_library(${TARGET_NAME} SRCS ${srcs} DEPS ${common_deps}
             ${detection_library_DEPS})

  set(LOCAL_DETECTION_LIBS
      ${TARGET_NAME} ${LOCAL_DETECTION_LIBS}
      PARENT_SCOPE)
endfunction()

if(WITH_ASCEND_CL)
  detection_library(box_coder_op SRCS box_coder_op.cc box_coder_op_npu.cc)
  detection_library(density_prior_box_op SRCS density_prior_box_op.cc
                    density_prior_box_op.cu density_prior_box_op_npu.cc)
else()
  detection_library(box_coder_op SRCS box_coder_op.cc)
  detection_library(density_prior_box_op SRCS density_prior_box_op.cc
                    density_prior_box_op.cu)
endif()

if(WITH_XPU)
  detection_library(iou_similarity_op SRCS iou_similarity_op.cc
                    iou_similarity_op_xpu.cc)
  detection_library(prior_box_op SRCS prior_box_op.cc)
  detection_library(yolo_box_op SRCS yolo_box_op.cc)
  detection_library(generate_proposals_v2_op SRCS generate_proposals_v2_op.cc)
elseif(WITH_MLU)
  detection_library(iou_similarity_op SRCS iou_similarity_op.cc
                    iou_similarity_op_mlu.cc)
  detection_library(prior_box_op SRCS prior_box_op.cc prior_box_op_mlu.cc)
  detection_library(yolo_box_op SRCS yolo_box_op.cc yolo_box_op_mlu.cc)
elseif(WITH_ASCEND_CL)
  detection_library(iou_similarity_op SRCS iou_similarity_op.cc
                    iou_similarity_op_npu.cc)
  detection_library(prior_box_op SRCS prior_box_op.cc prior_box_op_npu.cc)
  detection_library(yolo_box_op SRCS yolo_box_op.cc)
else()
  detection_library(iou_similarity_op SRCS iou_similarity_op.cc
                    iou_similarity_op.cu)
  detection_library(prior_box_op SRCS prior_box_op.cc)
  detection_library(yolo_box_op SRCS yolo_box_op.cc)
  # detection_library(generate_proposals_v2_op SRCS generate_proposals_v2_op.cc)
endif()

detection_library(bipartite_match_op SRCS bipartite_match_op.cc)
detection_library(mine_hard_examples_op SRCS mine_hard_examples_op.cc)
detection_library(anchor_generator_op SRCS anchor_generator_op.cc
                  anchor_generator_op.cu)
detection_library(target_assign_op SRCS target_assign_op.cc target_assign_op.cu)
detection_library(polygon_box_transform_op SRCS polygon_box_transform_op.cc
                  polygon_box_transform_op.cu)
detection_library(rpn_target_assign_op SRCS rpn_target_assign_op.cc)
detection_library(generate_proposal_labels_op SRCS
                  generate_proposal_labels_op.cc)
detection_library(multiclass_nms_op SRCS multiclass_nms_op.cc DEPS gpc)
detection_library(locality_aware_nms_op SRCS locality_aware_nms_op.cc DEPS gpc)
detection_library(matrix_nms_op SRCS matrix_nms_op.cc DEPS gpc)
detection_library(box_clip_op SRCS box_clip_op.cc box_clip_op.cu)
{'fraction_non_alphanumeric': 0.06853061844704453, 'fraction_numerical': 0.002279288861875095, 'mean_word_length': 4.989080982711556, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3099523', 'n_tokens_mistral': 2528, 'n_tokens_neox': 2400, 'n_words': 345}