getParameters can return empty tensor

If parameters() is not defined or returns an empty table,
getParameters() will return an empty tensor.