code: def test_trainer_precision(self):
      model = ResNet18(
          10, pretrained=False, include_top=False, freeze=True
      )
      loss = nn.CrossEntropyLoss()
      optimizer = torch.optim.Adam(model.parameters(), lr=0.01)
      pl_model = Trainer.compile(model, loss, optimizer)
      # torch must be greater or euqal to 1.10 to use native amp for bfloat16 precision
      if TORCH_VERSION_LESS_1_10:
          trainer = Trainer(max_epochs=2, precision=64)
          trainer.fit(pl_model, self.train_loader)
          assert isinstance(
              trainer.strategy.precision_plugin, DoublePrecisionPlugin
          )
          opt = pl_model.optimizers()
          assert opt.param_groups[0]["params"][0].dtype is torch.float64
      else:
          trainer = Trainer(max_epochs=2, precision="bf16")
          trainer.fit(pl_model, self.train_loader)
          assert isinstance(
              trainer.strategy.precision_plugin,
              NativeMixedPrecisionPlugin,
          )
          # model is not converted to bfloat16 precision
          input = TensorDataset(torch.rand(1, 3, 32, 32))
          train_loader = DataLoader(input)
          y_hat = trainer.predict(pl_model, train_loader)
  
file_path: BigDL/python/nano/test/pytorch/tests/train/trainer/test_trainer_precision.py
imports: import os
  from unittest import TestCase
  import pytest
  import torch
  from torch import nn
  from torch.utils.data import DataLoader, TensorDataset
  from pytorch_lightning.plugins.precision.native_amp import NativeMixedPrecisionPlugin
  from pytorch_lightning.plugins.precision.double import DoublePrecisionPlugin
  from bigdl.nano.pytorch import Trainer
  from bigdl.nano.pytorch.vision.models import vision
  from bigdl.nano.utils.pytorch import TORCH_VERSION_LESS_1_10
  from test.pytorch.utils._train_torch_lightning import create_data_loader, create_test_data_loader, data_transform
label_desc: Use image node_id 1 for calling the TestTrainer obj's underlying member method code with example usage: obj.test_trainer_precision() without return types