code: def test__encode_str__decode_str():
      device = torch.device(
          "cpu" if not torch.cuda.is_available() else "cuda"
      )
      s = "test-abcedfg"
  
      encoded_s = ComputationModel._encode_str(s, device, 1024)
      assert isinstance(
          encoded_s, torch.Tensor
      ) and encoded_s.shape == (1, 1025)
  
      decoded_s = ComputationModel._decode_str(encoded_s)
      assert isinstance(decoded_s, list) and len(decoded_s) == 1
      assert decoded_s[0] == s
  
file_path: ignite/tests/ignite/distributed/comp_models/test_base.py
imports: import pytest
  import torch
  from ignite.distributed.comp_models.base import _SerialModel, _torch_version_le_112, ComputationModel
label_desc: Use image node_id 2 for calling a global function with example usage: test__encode_str__decode_str() without return types