apple / apple/coremltools

unsqueeze or expand dims not supported for complex64,

Open
#2,261 2 comments 0 reactions 0 assignees View on GitHub
feature request
Dominant language
Python
Stars
5.4k
Forks
850
Avg merge
4d 5h
Merged PRs (30d)
10

Description

@register_torch_op(torch_alias=["unsqueeze_copy"])
def unsqueeze(context, node):
inputs = _get_inputs(context, node, expected=2)
unsqueeze = mb.expand_dims(x=inputs[0], axes=[inputs[1].val], name=node.name)
context.add(unsqueeze)

also
ValueError: Op "1298" (op_type: expand_dims) Input x="freqs_cis.1" expects tensor or scalar of dtype from type domain ['fp16', 'fp32', 'int8', 'int16', 'int32', 'uint8', 'uint16', 'bool'] but got tensor[1024,32,complex64]

unsqueeze or expand dims not supported for complex64, any workaround or can it be supported?? @junpeiz @srjoglekar246 ??

Contributor guide

Open the contributing guide

Research direction

Start from the registered unsqueeze handler shown in the issue and the mb.expand_dims call, then reproduce the failure with a complex64 input. Trace the dtype restrictions for expand_dims and related converter tests; done means unsqueeze or expand_dims accepts complex64 without the reported type-domain error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.