| 371 | |
| 372 | |
| 373 | class TupleProxy(StructInfoProxy): |
| 374 | fields: list[StructInfoProxy] |
| 375 | """The type of tuple values. |
| 376 | |
| 377 | Parameters |
| 378 | ---------- |
| 379 | fields : List[StructInfoProxy] |
| 380 | The fields in the tuple |
| 381 | """ |
| 382 | |
| 383 | def __init__( |
| 384 | self, |
| 385 | *fields: list[StructInfoProxy], |
| 386 | ) -> None: |
| 387 | if len(fields) == 1 and isinstance(fields[0], tuple | list): |
| 388 | fields = fields[0] |
| 389 | # convert `R.Tensor` to `R.Tensor()` |
| 390 | self.fields = [field() if callable(field) else field for field in fields] |
| 391 | |
| 392 | def get_symbolic_vars(self) -> set[str]: |
| 393 | return set().union(*[f.get_symbolic_vars() for f in self.fields]) |
| 394 | |
| 395 | def as_struct_info(self, dict_globals: dict[str, Any] | None = None) -> TupleStructInfo: |
| 396 | fields = [field.as_struct_info(dict_globals) for field in self.fields] |
| 397 | return TupleStructInfo(fields) |
| 398 | |
| 399 | |
| 400 | def Tuple(*fields: list[StructInfoProxy]) -> TupleProxy: |
no outgoing calls
no test coverage detected
searching dependent graphs…