Skip to content

Commit df34358

Browse files
authored
Merge pull request #204 from astnmsn/fix/wasm-async-recursion
set async_recursion to ?Send for wasm32 arch
2 parents 7880ed8 + af090b5 commit df34358

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

wonnx/src/optimizer.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ impl<'model> Optimizer<'model> {
292292
}
293293

294294
/// Optimize a branch of a graph (memoized)
295-
#[async_recursion]
295+
#[cfg_attr(target_arch = "wasm32", async_recursion(?Send))]
296+
#[cfg_attr(not(target_arch = "wasm32"), async_recursion)]
296297
pub async fn optimize(
297298
&mut self,
298299
node: Arc<Node<'model>>,
@@ -310,7 +311,8 @@ impl<'model> Optimizer<'model> {
310311

311312
/// Optimize a branch of a graph. Takes a node an attempts to form a chain of nodes with single (dynamic) inputs by
312313
/// traversing towards the inputs.
313-
#[async_recursion]
314+
#[cfg_attr(target_arch = "wasm32", async_recursion(?Send))]
315+
#[cfg_attr(not(target_arch = "wasm32"), async_recursion)]
314316
async fn optimize_actual(
315317
&mut self,
316318
node: Arc<Node<'model>>,

0 commit comments

Comments
 (0)