Skip to content

[jit] add support for tuple unpacking in for loops #20239

@TheCodez

Description

@TheCodez

🚀 Feature

Add support for tuple unpacking in for loops

Motivation

Makes working with tuples a better experience and the code shorter.

Pitch

This should be possible:

import torch

@torch.jit.script
def test():
  fm = [(64, 32), (32, 16), (16, 8)]
  
  for width, height in fm:
    pass

Alternatives

A current workaround is to use:

import torch

@torch.jit.script
def test():
  fm = [(64, 32), (32, 16), (16, 8)]
  
  for f in fm:
	width, height = f
    pass

Metadata

Metadata

Assignees

Labels

oncall: jitAdd this issue/PR to JIT oncall triage queuetriagedThis 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