Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions coremltools/converters/mil/frontend/torch/test/test_torch_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -7277,6 +7277,25 @@ def forward(self, spans, embedding):
compute_unit=compute_unit,
)

def test_cast_length_1_constant_tensor(self):
class TestModel(torch.nn.Module):
def forward(self, x):
b, c, h, w = x.shape
return x.reshape(b, c, int(h * w))

x = torch.rand(1, 2, 4, 4)
torch_model = export_torch_model_to_frontend(
TestModel().eval(),
(x,),
TorchFrontend.TORCHSCRIPT,
)
ct.convert(
torch_model,
inputs=[ct.TensorType(shape=x.shape)],
convert_to="neuralnetwork",
minimum_deployment_target=ct.target.iOS14,
)

@pytest.mark.parametrize(
"compute_unit, backend, frontend",
itertools.product(compute_units, backends, frontends),
Expand Down