MCPcopy Create free account
hub / github.com/OpenNMT/CTranslate2 / TorchModel

Class TorchModel

python/tests/test_spec.py:291–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289 variable_dtype = getattr(torch, variable_dtype)
290
291 class TorchModel(ctranslate2.specs.ModelSpec):
292 def __init__(self):
293 super().__init__()
294 self.dense = common_spec.LinearSpec()
295 self.dense.weight = torch.ones([16, 4], dtype=variable_dtype)
296 self.dense.bias = torch.ones([16], dtype=variable_dtype)
297
298 @property
299 def name(self):
300 return "TorchModel"
301
302 model = TorchModel()
303 model.validate()

Callers 1

test_torch_variablesFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_torch_variablesFunction · 0.68