class_docstr: Tests for bluefog/torch/mpi_ops.py
class_docstr_tok: ["Tests","for","bluefog\/torch\/mpi_ops.py"]
code: def convert_cpu_fp16_to_fp32(self, *values):
      # PyTorch doesn't support any CPU ops on FP16 tensors.
      # In case we need to do ops, we will convert tensor to FP32 here.
      result = []
      for value in values:
          if (
              value.dtype in [torch.float16, torch.HalfTensor]
              and not value.is_cuda
          ):
              result.append(value.float())
          else:
              result.append(value)
      return result
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import inspect
  import itertools
  import unittest
  import warnings
  import numpy
  import pytest
  import torch
  import networkx
  import bluefog.torch
  from bluefog.common import topology_util
  from common import is_openmpi_built
label_desc: Use image node_id 3 for calling the OpsTests obj's underlying member method code with example usage: obj.convert_cpu_fp16_to_fp32() and returns: result