Skip to content

[ONNX]RuntimeError: Unexpected node type: onnx::Cast #47182

@oneway234

Description

@oneway234

❓convert faild

class Decoder(nn.Module):
    def __init__(self, N, L):
        super(Decoder, self).__init__()
        # Hyper-parameter
        self.N, self.L = N, L
        # Components
        self.basis_signals = nn.Linear(N, L, bias=False)

    def forward(self, mixture_w, est_mask):
        """
        Args:
            mixture_w: [M, N, K]
            est_mask: [M, C, N, K]
        Returns:
            est_source: [M, C, T]
        """
        # D = W * M
        source_w = torch.unsqueeze(mixture_w, 1) * est_mask  # [M, C, N, K]
        source_w = torch.transpose(source_w, 2, 3)  # [M, C, K, N]
        # S = DV
        est_source = self.basis_signals(source_w)  # [M, C, K, L]
        est_source = overlap_and_add(est_source, self.L // 2)  # M x C x T
        return est_source

This is the model which I converted. It has two inputs, and it's a Linear NN. As I know onnx.export support mutiple inputs.
So I convert it with the following code:

model = ConvTasNet.load_model(args.model_path)
model.eval()
Decoder = model.decoder

torch.onnx.export(Decoder, (separator_input, decoder_input),
                                                 decoder_path,
                                                 export_params=True )

But I got this error.

RuntimeError: Unexpected node type: onnx::Cast

Further information
Pytorch 1.7

cc @houseroad @spandantiwari @lara-hdr @BowenBao @neginraoof

Metadata

Metadata

Assignees

Labels

module: onnxRelated to torch.onnxneeds reproductionEnsure you have actionable steps to reproduce the issue. Someone else needs to confirm the repro.triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions