torcharrow.functional.get_score_sum¶
- torcharrow.functional.get_score_sum(input_ids: ListColumn, input_id_scores: ListColumn, matching_ids: ListColumn, matching_id_scores: ListColumn)¶
返回所有匹配_id_scores 中分数的总和,这些分数对应的 id 在匹配_ids 中,并且也存在于 input_ids 中。:param input_ids: :type input_ids: 第一个 id 列表 :param input_ids_scores: :type input_ids_scores: input_ids 的分数(权重) :param matching_ids: :type matching_ids: 第二个 id 列表 :param matching_ids_scores: :type matching_ids_scores: matching_ids 的分数(权重)
示例
>>> import torcharrow as ta >>> from torcharrow import functional >>> input_ids = ta.column([[1, 2, 3]]) >>> input_id_scores = ta.column([[1.0,2.0,3.0]]) >>> matching_ids = ta.column([[1,2]]) >>> matching_id_scores = ta.column([[5.0,4.0]]) >>> functional.get_score_sum(input_ids, input_id_scores, matching_ids, matching_id_scores) 0 9 dtype: Float32(nullable=True), length: 1, null_count: 0