15434d0f74feb6735402bf7688b6d9540497d43a,src/spn/algorithms/layerwise/layers.py,Product,sample,#Product#Any#Any#,234
Before Change
if indices is None:
return torch.zeros(n, 1)
sample_indices = torch.repeat_interleave(indices, repeats=self.cardinality, dim=1)
if self._pad:
After Change
if context is None:
if self.num_repetitions == 1:
return SamplingContext(
n=n,
parent_indices=torch.zeros(n, 1, dtype=int, device=self.__device),
repetition_indices=torch.zeros(n, dtype=int, device=self.__device),
)
else:
raise Exception(
"Cannot start sampling from Product layer with num_repetitions > 1 and no context given."
)
else:
indices = torch.repeat_interleave(context.parent_indices, repeats=self.cardinality, dim=1)
if self._pad:
indices = indices[:, : -self._pad]
context.parent_indices = indices
return context
def __repr__(self):
return "Product(in_features={}, cardinality={}, out_shape={})".format(
self.in_features, self.cardinality, self.out_shape
)

In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 9
Instances
Project Name: SPFlow/SPFlow
Commit Name: 15434d0f74feb6735402bf7688b6d9540497d43a
Time: 2020-04-03
Author: steven.lang.mz@gmail.com
File Name: src/spn/algorithms/layerwise/layers.py
Class Name: Product
Method Name: sample
Project Name: SPFlow/SPFlow
Commit Name: 15434d0f74feb6735402bf7688b6d9540497d43a
Time: 2020-04-03
Author: steven.lang.mz@gmail.com
File Name: src/spn/algorithms/layerwise/layers.py
Class Name: CrossProduct
Method Name: sample
Project Name: dmlc/dgl
Commit Name: 18a26fcfb1983af7fba69db9bdce7ba5e6a9945f
Time: 2020-06-29
Author: VoVAllen@users.noreply.github.com
File Name: python/dgl/data/graph_serialize.py
Class Name:
Method Name: load_graphs