code: def train(
      conf, model, device, train_loader, optimizer, epoch, writer
  ):
      model.train()
      for batch_idx, (data, target) in enumerate(train_loader):
          data, target = data.to(device), target.to(device)
          optimizer.zero_grad()
          output = model(data)
          loss = F.nll_loss(output, target)
          loss.backward()
          optimizer.step()
          if batch_idx % conf.log_interval == 0:
              loss = loss.item()
              idx = batch_idx + epoch * (len(train_loader))
              writer.add_scalar("Loss/train", loss, idx)
              print(
                  "Train Epoch: {} [{}/{} ({:.0f}%)]\tLoss: {:.6f}".format(
                      epoch,
                      batch_idx * len(data),
                      len(train_loader.dataset),
                      100.0 * batch_idx / len(train_loader),
                      loss,
                  )
              )
  
file_path: pytorch-optimizer/examples/mnist.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from torch.optim.lr_scheduler import StepLR
  from torch.utils.tensorboard import SummaryWriter
  from torchvision import datasets, transforms, utils
  import torch_optimizer
label_desc: Use image node_id 1 for calling a global function with example usage: train(conf, model, device, train_loader, optimizer, epoch, writer) without return types