Updated mlp tests

This commit is contained in:
Matt Tancik committed 2022-04-18 17:51:39 -07:00
1 parent 0ac2708959
commit 83c664e65a
3 files changed
+37 -5

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
"""
MLP Test
"""
import pytest
import torch
from torch import nn
from mattport.nerf.field_modules import MLP
def test_mlp():
"""Test mlp"""
in_dim = 6
out_dim = 10
num_layers = 2
layer_width = 32
out_activation = nn.ReLU()
mlp = MLP(
in_dim=in_dim, out_dim=out_dim, num_layers=num_layers, layer_width=layer_width, out_activation=out_activation
)
assert mlp.get_out_dim() == out_dim
x = torch.ones((9, in_dim))
mlp.build_nn_modules()
y = mlp(x)
assert y.shape[-1] == out_dim
if __name__ == "__main__":
test_mlp()