@@ -156,31 +156,45 @@ export declare namespace JSEP {
156156 */
157157 shouldTransferToMLTensor : boolean ;
158158
159+ /**
160+ * [exported from pre-jsep.js] Called when InferenceSession.run started. This function will be called before
161+ * _OrtRun[WithBinding]() is called.
162+ * @param sessionId - specify the session ID.
163+ */
164+ webnnOnRunStart : ( sessionId : number ) => void ;
165+ /**
166+ * [exported from pre-jsep.js] Release a session. This function will be called before _OrtReleaseSession() is
167+ * called.
168+ * @param sessionId - specify the session ID.
169+ * @returns
170+ */
171+ webnnOnReleaseSession : ( sessionId : number ) => void ;
172+
159173 /**
160174 * [exported from pre-jsep.js] Called when InferenceSession.run finished. This function will be called after
161175 * _OrtRun[WithBinding]() is called.
162176 * @param sessionId - specify the session ID.
163177 */
164- jsepOnRunEnd : ( sessionId : number ) => void ;
178+ webnnOnRunEnd : ( sessionId : number ) => void ;
165179
166180 /**
167181 * [exported from pre-jsep.js] Register MLContext for a session.
168182 * @param sessionId - specify the session ID.
169183 * @param context - specify the MLContext.
170184 * @returns
171185 */
172- jsepRegisterMLContext : ( sessionId : number , context : MLContext ) => void ;
186+ webnnRegisterMLContext : ( sessionId : number , context : MLContext ) => void ;
173187 /**
174188 * [exported from pre-jsep.js] Reserve a MLTensor ID attached to the current session.
175189 * @returns the MLTensor ID.
176190 */
177- jsepReserveTensorId : ( ) => number ;
191+ webnnReserveTensorId : ( ) => number ;
178192 /**
179193 * [exported from pre-jsep.js] Release an MLTensor ID from use and destroys underlying MLTensor if no longer in use.
180194 * @param tensorId - specify the MLTensor ID.
181195 * @returns
182196 */
183- jsepReleaseTensorId : ( tensorId : number ) => void ;
197+ webnnReleaseTensorId : ( tensorId : number ) => void ;
184198 /**
185199 * [exported from pre-jsep.js] Ensure that an MLTensor of a given type and shape exists for a MLTensor ID.
186200 * @param sessionId - specify the session ID or current active session ID if undefined.
@@ -190,7 +204,7 @@ export declare namespace JSEP {
190204 * @param copyOld - specify whether to copy the old tensor if a new tensor was created.
191205 * @returns the MLTensor associated with the tensor ID.
192206 */
193- jsepEnsureTensor : (
207+ webnnEnsureTensor : (
194208 sessionId : number | undefined ,
195209 tensorId : number ,
196210 dataType : DataType ,
@@ -203,20 +217,20 @@ export declare namespace JSEP {
203217 * @param data - specify the data to upload. It can be a TensorProto::data_type or a WebNN MLOperandDataType.
204218 * @returns
205219 */
206- jsepUploadTensor : ( tensorId : number , data : Uint8Array ) => void ;
220+ webnnUploadTensor : ( tensorId : number , data : Uint8Array ) => void ;
207221 /**
208222 * [exported from pre-jsep.js] Download data from an MLTensor.
209223 * @param tensorId - specify the MLTensor ID.
210224 * @returns the downloaded data.
211225 */
212- jsepDownloadTensor : ( tensorId : number , dstBuffer : ArrayBufferView | ArrayBuffer ) => Promise < undefined > ;
226+ webnnDownloadTensor : ( tensorId : number , dstBuffer : ArrayBufferView | ArrayBuffer ) => Promise < undefined > ;
213227 /**
214228 * [exported from pre-jsep.js] Creates a downloader function to download data from an MLTensor.
215229 * @param tensorId - specify the MLTensor ID.
216230 * @param type - specify the data type.
217231 * @returns the downloader function.
218232 */
219- jsepCreateMLTensorDownloader : (
233+ webnnCreateMLTensorDownloader : (
220234 tensorId : number ,
221235 type : Tensor . MLTensorDataTypes ,
222236 ) => ( ) => Promise < Tensor . DataTypeMap [ Tensor . MLTensorDataTypes ] > ;
@@ -228,7 +242,7 @@ export declare namespace JSEP {
228242 * @param dimensions - specify the dimensions.
229243 * @returns the MLTensor ID for the external MLTensor.
230244 */
231- jsepRegisterMLTensor : (
245+ webnnRegisterMLTensor : (
232246 sessionId : number ,
233247 tensor : MLTensor ,
234248 onnxDataType : DataType ,
@@ -240,7 +254,7 @@ export declare namespace JSEP {
240254 * @param optionsOrGpuDevice - specify the options or GPUDevice.
241255 * @returns
242256 */
243- jsepCreateMLContext ( optionsOrGpuDevice ?: MLContextOptions | GPUDevice ) : Promise < MLContext > ;
257+ webnnCreateMLContext ( optionsOrGpuDevice ?: MLContextOptions | GPUDevice ) : Promise < MLContext > ;
244258
245259 /**
246260 * [exported from pre-jsep.js] Register a WebNN Constant operand from external data.
@@ -252,7 +266,7 @@ export declare namespace JSEP {
252266 * @param shouldConvertInt64ToInt32 - specify whether to convert int64 to int32.
253267 * @returns the WebNN Constant operand for the specified external data.
254268 */
255- jsepRegisterMLConstant (
269+ webnnRegisterMLConstant (
256270 externalFilePath : string ,
257271 dataOffset : number ,
258272 dataLength : number ,
@@ -265,28 +279,28 @@ export declare namespace JSEP {
265279 * [exported from pre-jsep.js] Register a WebNN graph input.
266280 * @param inputName - specify the input name.
267281 */
268- jsepRegisterGraphInput : ( inputName : string ) => void ;
282+ webnnRegisterGraphInput : ( inputName : string ) => void ;
269283 /**
270284 * [exported from pre-jsep.js] Check if a graph input is a WebNN graph input.
271285 * @param sessionId - specify the session ID.
272286 * @param inputName - specify the input name.
273287 * @returns whether the input is a WebNN graph input.
274288 */
275- jsepIsGraphInput : ( sessionId : number , inputName : string ) => boolean ;
289+ webnnIsGraphInput : ( sessionId : number , inputName : string ) => boolean ;
276290 /**
277291 * [exported from pre-jsep.js] Create a temporary MLTensor for a session.
278292 * @param sessionId - specify the session ID.
279293 * @param dataType - specify the data type.
280294 * @param shape - specify the shape.
281295 * @returns the MLTensor ID for the temporary MLTensor.
282296 */
283- jsepCreateTemporaryTensor : ( sessionId : number , dataType : DataType , shape : readonly number [ ] ) => Promise < number > ;
297+ webnnCreateTemporaryTensor : ( sessionId : number , dataType : DataType , shape : readonly number [ ] ) => Promise < number > ;
284298 /**
285299 * [exported from pre-jsep.js] Check if a session's associated WebNN Context supports int64.
286300 * @param sessionId - specify the session ID.
287301 * @returns whether the WebNN Context supports int64.
288302 */
289- jsepIsInt64Supported : ( sessionId : number ) => boolean ;
303+ webnnIsInt64Supported : ( sessionId : number ) => boolean ;
290304 }
291305}
292306
0 commit comments