"""External function interface to cuBLAS libraries."""from__future__importabsolute_importas_absfrom..importapias_apifrom..importintrinas_intrindefmatmul(lhs,rhs,transa=False,transb=False):"""Create an extern op that compute matrix mult of A and rhs with cuBLAS Parameters ---------- lhs : Tensor The left matrix operand rhs : Tensor The right matrix operand transa : bool Whether transpose lhs transb : bool Whether transpose rhs Returns ------- C : Tensor The result tensor. """n=lhs.shape[1]iftransaelselhs.shape[0]m=rhs.shape[0]iftransbelserhs.shape[1]return_api.extern((n,m),[lhs,rhs],lambdains,outs:_intrin.call_packed("tvm.contrib.cublas.matmul",ins[0],ins[1],outs[0],transa,transb),name="C")