def test_get_config(self, random_onehot_rbf_vectors, random_features_and_targets): _, *point_cloud = random_onehot_rbf_vectors features, targets = random_features_and_targets conv = layers.Convolution() _ = conv(list(point_cloud) + list(features)) config = conv.get_config() assert config["trainable"] is True and config["si_units"] == 16
def test_custom_radial( self, random_onehot_rbf_vectors, random_features_and_targets ): class MyRadial(layers.DenseRadialFactory): def __init__(self, num_units, **kwargs): super().__init__() self.num_units = num_units def get_radial(self, feature_dim, input_order=None, filter_order=None): return Dense(feature_dim) @classmethod def from_json(cls, json_str: str): return cls(**json.loads(json_str)) get_custom_objects().update({MyRadial.__name__: MyRadial}) _, *point_cloud = random_onehot_rbf_vectors features, targets = random_features_and_targets conv = layers.Convolution( radial_factory="MyRadial", factory_kwargs={"num_units": 6} ) _ = conv(list(point_cloud) + list(features)) config = json.loads(conv.radial_factory.to_json()) assert config["type"] == "MyRadial" assert config["num_units"] == 6
def test_provided_radial_string( self, random_onehot_rbf_vectors, random_features_and_targets ): _, *point_cloud = random_onehot_rbf_vectors features, targets = random_features_and_targets conv = layers.Convolution(radial_factory="DenseRadialFactory") _ = conv(list(point_cloud) + list(features)) config = json.loads(conv.radial_factory.to_json()) assert config["type"] == "DenseRadialFactory" assert config["units"] == 32
def test_provided_radial_string_and_kwargs( self, random_onehot_rbf_vectors, random_features_and_targets ): _, *point_cloud = random_onehot_rbf_vectors features, targets = random_features_and_targets conv = layers.Convolution( radial_factory="DenseRadialFactory", factory_kwargs={"num_layers": 3, "units": 4, "kernel_lambda": 0.01}, ) _ = conv(list(point_cloud) + list(features)) config = json.loads(conv.radial_factory.to_json()) assert config["units"] == 4
def test_provided_radial_json( self, random_onehot_rbf_vectors, random_features_and_targets ): _, *point_cloud = random_onehot_rbf_vectors features, targets = random_features_and_targets d = { "type": "DenseRadialFactory", "num_layers": 3, "units": 4, "kernel_lambda": 0.01, } _ = layers.Convolution(radial_factory=json.dumps(d))( list(point_cloud) + list(features) )
def test_defaults(self, random_onehot_rbf_vectors, random_features_and_targets): _, *point_cloud = random_onehot_rbf_vectors features, targets = random_features_and_targets output = layers.Convolution()(list(point_cloud) + features) assert len(output) == 2