feat: raise initializer error on unavailable data
This commit is contained in:
parent
07a2d6caaa
commit
62df3c0457
@ -217,6 +217,8 @@ class AbstractStratifiedCompInitializer(AbstractClassAwareCompInitializer):
|
|||||||
components = torch.tensor([])
|
components = torch.tensor([])
|
||||||
for k, v in distribution.items():
|
for k, v in distribution.items():
|
||||||
stratified_data = self.data[self.targets == k]
|
stratified_data = self.data[self.targets == k]
|
||||||
|
if len(stratified_data) == 0:
|
||||||
|
raise ValueError(f"No data available for class {k}.")
|
||||||
initializer = self.subinit_type(
|
initializer = self.subinit_type(
|
||||||
stratified_data,
|
stratified_data,
|
||||||
noise=self.noise,
|
noise=self.noise,
|
||||||
|
Loading…
Reference in New Issue
Block a user