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

Function create_tensor

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

Source from the content-addressed store, hash-verified

116 return filtered_sentence_tag
117
118def create_tensor(features, attribute, dtype, device):
119 try:
120 return torch.tensor([getattr(f, attribute) for f in features], dtype=dtype).to(device)
121 except Exception as e:
122 if attribute not in create_tensor.attribute_warning:
123 print("Exception in attribute {}".format(attribute))
124 print(e)
125 create_tensor.attribute_warning.add(attribute)
126 return None
127
128create_tensor.attribute_warning = set([])
129

Callers

nothing calls this directly

Calls 2

toMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected