MCPcopy Create free account
hub / github.com/awslabs/gap-text2sql / create_tensor_by_stacking

Function create_tensor_by_stacking

relogic/logickit/utils/utils.py:130–139  ·  view source on GitHub ↗
(features, attribute, dtype, device)

Source from the content-addressed store, hash-verified

128create_tensor.attribute_warning = set([])
129
130def 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
141create_tensor_by_stacking.attribute_warning = set([])
142

Callers

nothing calls this directly

Calls 2

toMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected