Function: search

Applicable Products

Product

Supported (√/x)

Ascend 950PR&950DT products

x

Atlas A3 products

x

Atlas A2 products

x

Atlas training products

x

Atlas inference products

√

Atlas 200I/500 A2 inference products

x

Description

Performs 1:N or N:M feature search.

This API is not supported for Atlas inference accelerator modules in Atlas inference products.

Prototype

  • C Prototype
    1
    aclError aclfvSearch(aclfvSearchType type, aclfvSearchInput *searchInput, aclfvSearchResult *searchRst)
    
  • Python Function
    1
    ret = acl.fv.search(type, search_input, search_result)
    

Parameters

Parameter

Description

type

Int, feature description. For details, see aclfvSearchType.

search_input

  • Int, address of the pointer that points to search input.

    Call acl.fv.create_search_input to create data of the aclfvSearchInput type in advance.

search_result

  • Int, address of the pointer that points to the search output.

    Call acl.fv.create_search_result to create data of the aclfvSearchResult type in advance. queryCnt in the data must be the same as that in the searchInput.

    The number of returned search results is specified by the topK passed to the acl.fv.create_search_input call and is also restricted by the maximum value of the topK specified by the acl.fv.init call for initialization. If the topK passed to the acl.fv.create_search_input call is greater than or equal to that passed to the acl.fv.init call, the maximum number set in the acl.fv.init call takes precedence; otherwise, the topK passed to the acl.fv.create_search_input call applies.

Return Values

Return Value

Description

ret

Int, error code.

Constraints

  • In N:M mode, multithreaded adding, search, or deletion is not allowed.
  • In 1:N or N:M mode, if no repository is added, zero results are returned by the acl.fv.search call.
  • This API call automatically creates a stream for synchronous task execution within the API. When the tasks are complete, the stream is automatically destroyed.

    Hardware has restrictions on the total number of streams. For details, see Function: create_stream.

Reference

For details about the API call sequence and sample code, see Feature Vector Search.