Function
create_tensor_by_stacking
(features, attribute, dtype, device)
Source from the content-addressed store, hash-verified
| 128 | create_tensor.attribute_warning = set([]) |
| 129 | |
| 130 | def create_tensor_by_stacking(features, attribute, dtype, device): |
| 131 | try: |
| 132 | return torch.tensor( |
| 133 | list(itertools.chain(*[getattr(f, attribute) for f in features])), dtype=dtype).to(device) |
| 134 | except Exception as e: |
| 135 | if attribute not in create_tensor.attribute_warning: |
| 136 | print("Exception in attribute {}".format(attribute)) |
| 137 | print(e) |
| 138 | create_tensor.attribute_warning.add(attribute) |
| 139 | return None |
| 140 | |
| 141 | create_tensor_by_stacking.attribute_warning = set([]) |
| 142 | |
Callers
nothing calls this directly
Tested by
no test coverage detected