class_docstr: Test MLPModule.
class_docstr_tok: ["Test","MLPModule","."]
docstr: Test output values from MLPModule.
  
  Args:
      input_dim (int): Input dimension.
      output_dim (int): Ouput dimension.
      hidden_sizes (list[int]): Size of hidden layers.
docstr_tok: ["Test","output","values","from","MLPModule",".","Args",":","input_dim","(","int",")",":","Input","dimension",".","output_dim","(","int",")",":","Ouput","dimension",".","hidden_sizes","(","list","[","int","]",")",":","Size","of","hidden","layers","."]
code: def test_output_values(self, input_dim, output_dim, hidden_sizes):
      """Test output values from MLPModule.
  
      Args:
          input_dim (int): Input dimension.
          output_dim (int): Ouput dimension.
          hidden_sizes (list[int]): Size of hidden layers.
  
      """
      input_val = torch.ones([1, input_dim], dtype=torch.float32)
      module_with_nonlinear_function_and_module = MLPModule(
          input_dim=input_dim,
          output_dim=output_dim,
          hidden_nonlinearity=torch.relu,
          hidden_sizes=hidden_sizes,
          hidden_w_init=nn.init.ones_,
          output_w_init=nn.init.ones_,
          output_nonlinearity=torch.nn.ReLU,
      )
  
      module_with_nonlinear_module_instance_and_function = MLPModule(
          input_dim=input_dim,
          output_dim=output_dim,
          hidden_nonlinearity=torch.nn.ReLU(),
          hidden_sizes=hidden_sizes,
          hidden_w_init=nn.init.ones_,
          output_w_init=nn.init.ones_,
          output_nonlinearity=torch.relu,
      )
  
      output1 = module_with_nonlinear_function_and_module(input_val)
      output2 = module_with_nonlinear_module_instance_and_function(
          input_val
      )
  
      expected_output = torch.full(
          [1, output_dim],
          fill_value=5 * np.prod(hidden_sizes),
          dtype=torch.float32,
      )
  
      assert torch.all(torch.eq(expected_output, output1))
      assert torch.all(torch.eq(expected_output, output2))
  
file_path: garage/tests/garage/torch/modules/test_mlp_module.py
imports: import pickle
  import numpy
  import pytest
  import torch
  import torch.nn
  from garage.torch.modules import MLPModule
label_desc: Use image node_id 1 for calling the TestMLPModel obj's underlying member method code with example usage: obj.test_output_values(input_dim, output_dim, hidden_sizes) without return types