MCPcopy Create free account
hub / github.com/pytorch/pytorch / add_ops

Method add_ops

caffe2/python/layers/sparse_lookup.py:533–557  ·  view source on GitHub ↗
(self, net)

Source from the content-addressed store, hash-verified

531 self._add_ops(net, self.trainer_version, is_train=True)
532
533 def add_ops(self, net):
534 version_info = get_current_scope().get(
535 get_sparse_lookup_predictor_version.__name__, {'version': 'fp32'}
536 )
537 lookup_table_blob_size = self.shape[0] * self.shape[1]
538 version = get_sparse_lookup_predictor_version(
539 version_info['version'],
540 blob_size=lookup_table_blob_size,
541 min_blob_size_4bits=(
542 version_info['min_blob_size_4bits']
543 if 'min_blob_size_4bits' in version_info
544 else None
545 ),
546 embedding_dim=self.shape[1],
547 sparse_feature_name=self.sparse_key,
548 )
549
550 # TODO(amalevich): Layer should not be responsible for decision about
551 # quantization.
552 if not self.support_8bit() and version in {'uint8rowwise',
553 'fused_uint8rowwise',
554 'fused_uint4rowwise'}:
555 version = 'fp16'
556
557 self._add_ops(net, version, is_train=False)

Callers

nothing calls this directly

Calls 5

support_8bitMethod · 0.95
_add_opsMethod · 0.95
get_current_scopeFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected