Repository: pytorch/ignite

Issue:
TensorboardLogger init - forwarding kwargs to SummaryWriter
### Problem 
When a TensorboardLogger object is created, it also initialises a SummaryWriter object. 
At the moment, the TensorboardLogger init function accepts the only argument `log_dir` that is passed to SummaryWriter but SummaryWriter accepts a lot more keyword arguments I want to make use of. 

[Link to current implementation](https://github.com/pytorch/ignite/blob/01f2f5f96f55b8358edfe280dc6852bbaf807425/ignite/contrib/handlers/tensorboard_logger.py#L402)
### Solution/Proposal
Forwarding all positional and keyword arguments to SummaryWriter. 

Would this also solve the tensorboardX compatibility issue #538?

-----------
Are there any restrictions I missed, why this is not implemented? 
If wanted, I can create a pull request. 


Discussion:
@Bibonaut yes, we can forward positional and kw args. Please, do no hesitate to send a PR to fix the issue :)

Resolving patch:
diff --git a/ignite/contrib/handlers/tensorboard_logger.py b/ignite/contrib/handlers/tensorboard_logger.py
--- a/ignite/contrib/handlers/tensorboard_logger.py
+++ b/ignite/contrib/handlers/tensorboard_logger.py
@@ -322,7 +322,9 @@ class TensorboardLogger(BaseLogger):
 
 
     Args:
-        log_dir (str): path to the directory where to log.
+        *args: Positional arguments accepted from :class:`~tensorboardx.SummaryWriter`.
+        **kwargs: Keyword arguments accepted from :class:`~tensorboardx.SummaryWriter`, for example,
+            `log_dir` to setup path to the directory where to log.
 
     Examples:
 
@@ -399,23 +401,14 @@ class TensorboardLogger(BaseLogger):
 
     """
 
-    def __init__(self, log_dir):
+    def __init__(self, *args, **kwargs):
         try:
             from tensorboardX import SummaryWriter
         except ImportError:
             raise RuntimeError("This contrib module requires tensorboardX to be installed. "
                                "Please install it with command: \n pip install tensorboardX")
 
-        try:
-            self.writer = SummaryWriter(logdir=log_dir)
-        except TypeError as err:
-            if "type object got multiple values for keyword argument 'logdir'" == str(err):
-                self.writer = SummaryWriter(log_dir=log_dir)
-                warnings.warn('tensorboardX version < 1.7 will not be supported '
-                              'after ignite 0.3.0; please upgrade',
-                              DeprecationWarning)
-            else:
-                raise err
+        self.writer = SummaryWriter(*args, **kwargs)
 
     def close(self):
         self.writer.close()


Test patch:
diff --git a/tests/ignite/contrib/handlers/test_tensorboard_logger.py b/tests/ignite/contrib/handlers/test_tensorboard_logger.py
--- a/tests/ignite/contrib/handlers/test_tensorboard_logger.py
+++ b/tests/ignite/contrib/handlers/test_tensorboard_logger.py
@@ -564,18 +564,6 @@ def mock_tb_module():
     sys.modules[module_name] = prev_tb_module
 
 
-def test_init_tb1p6(mock_tb_module):
-
-    def side_effect_v1p6(*args, **kwargs):
-        if 'logdir' in kwargs:
-            raise TypeError("type object got multiple values for keyword argument 'logdir'")
-
-    mock_tb_module.SummaryWriter = Mock(name='tensorboardX.SummaryWriter', side_effect=side_effect_v1p6)
-
-    with pytest.warns(DeprecationWarning, match=r'tensorboardX version < 1.7 will not be supported'):
-        TensorboardLogger(log_dir=None)
-
-
 def test_init_typeerror_exception(mock_tb_module):
 
     def side_effect(*args, **kwargs):