66from bioimageio .core .resource_io .io_ import load_raw_resource_description
77
88
9- def _test_build_spec (path , weight_type , tensorflow_version = None ):
9+ def _test_build_spec (path , weight_type , tensorflow_version = None , use_implicit_output_shape = False ):
1010 from bioimageio .core .build_spec import build_model
1111
1212 model_spec = load_raw_resource_description (path )
@@ -50,6 +50,11 @@ def _test_build_spec(path, weight_type, tensorflow_version=None):
5050 )
5151 if tensorflow_version is not None :
5252 kwargs ["tensorflow_version" ] = tensorflow_version
53+ if use_implicit_output_shape :
54+ kwargs ["input_name" ] = "input"
55+ kwargs ["output_reference" ] = "input"
56+ kwargs ["output_scale" ] = [1.0 , 1.0 , 1.0 , 1.0 ]
57+ kwargs ["output_offset" ] = [0.0 , 0.0 , 0.0 , 0.0 ]
5358 raw_model = build_model (** kwargs )
5459 spec .model .schema .Model ().dump (raw_model )
5560
@@ -58,6 +63,10 @@ def test_build_spec_pytorch(any_torch_model):
5863 _test_build_spec (any_torch_model , "pytorch_state_dict" )
5964
6065
66+ def test_build_spec_implicit_output_shape (unet2d_nuclei_broad_model ):
67+ _test_build_spec (unet2d_nuclei_broad_model , "pytorch_state_dict" , use_implicit_output_shape = True )
68+
69+
6170def test_build_spec_torchscript (any_torchscript_model ):
6271 _test_build_spec (any_torchscript_model , "pytorch_script" )
6372
0 commit comments