class_docstr: Test MLPModule.
class_docstr_tok: ["Test","MLPModule","."]
docstr: Test MLPModule with learnable non-linear functions.
docstr_tok: ["Test","MLPModule","with","learnable","non-linear","functions","."]
code: def test_mlp_with_learnable_non_linear_function(self):
      """Test MLPModule with learnable non-linear functions."""
      input_dim, output_dim, hidden_sizes = 1, 1, (3, 2)
  
      input_val = -torch.ones([1, input_dim], dtype=torch.float32)
      module = MLPModule(
          input_dim=input_dim,
          output_dim=output_dim,
          hidden_nonlinearity=torch.nn.PReLU(init=10.0),
          hidden_sizes=hidden_sizes,
          hidden_w_init=nn.init.ones_,
          output_w_init=nn.init.ones_,
          output_nonlinearity=torch.nn.PReLU(init=1.0),
      )
  
      output = module(input_val)
      output.sum().backward()
  
      for tt in module.parameters():
          assert torch.all(torch.ne(tt.grad, 0))
  
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 4 for calling the TestMLPModel obj's underlying member method code with example usage: obj.test_mlp_with_learnable_non_linear_function() without return types