I suppose your mem_bias is trainable?
If so, you should use register_parameter.
Using register_buffer makes sure the buffer is part of the model’s state_dict, but is not a Parameter.
For example the running_mean and running_var in BatchNorm layers are registered as buffers.
Your error comes probably from using Variables. Registered buffers should be Tensors (source 10).