7
7
# pyre-strict
8
8
9
9
import logging
10
+ import sys
10
11
import unittest
11
12
12
13
import torch
13
- from executorch .backends .apple .coreml .recipes import CoreMLRecipeProvider # pyre-ignore
14
14
from executorch .backends .xnnpack .recipes .xnnpack_recipe_provider import (
15
15
XNNPACKRecipeProvider ,
16
16
)
17
17
from executorch .export import export , recipe_registry
18
18
from executorch .export .target_recipes import get_ios_recipe
19
19
from executorch .runtime import Runtime
20
20
21
+ if sys .platform != "win32" :
22
+ from executorch .backends .apple .coreml .recipes import ( # pyre-ignore
23
+ CoreMLRecipeProvider ,
24
+ )
25
+
21
26
22
27
class TestTargetRecipes (unittest .TestCase ):
23
28
"""Test target recipes."""
@@ -26,12 +31,14 @@ def setUp(self) -> None:
26
31
torch ._dynamo .reset ()
27
32
super ().setUp ()
28
33
recipe_registry .register_backend_recipe_provider (XNNPACKRecipeProvider ())
29
- # pyre-ignore
30
- recipe_registry .register_backend_recipe_provider (CoreMLRecipeProvider ())
34
+ if sys .platform != "win32" :
35
+ # pyre-ignore
36
+ recipe_registry .register_backend_recipe_provider (CoreMLRecipeProvider ())
31
37
32
38
def tearDown (self ) -> None :
33
39
super ().tearDown ()
34
40
41
+ @unittest .skipIf (sys .platform == "win32" , "Core ML is not available on Windows." )
35
42
def test_ios_fp32_recipe_with_xnnpack_fallback (self ) -> None :
36
43
# Linear ops skipped by coreml but handled by xnnpack
37
44
class Model (torch .nn .Module ):
@@ -107,6 +114,7 @@ def forward(self, x, y):
107
114
et_output = session .run_method ("forward" , example_inputs [0 ])
108
115
logging .info (f"et output { et_output } " )
109
116
117
+ @unittest .skipIf (sys .platform == "win32" , "Core ML is not available on Windows." )
110
118
def test_ios_quant_recipes (self ) -> None :
111
119
class Model (torch .nn .Module ):
112
120
def __init__ (self ):
0 commit comments