code: def test_sphere_check(dim):
      data = torch.randn(100, dim)
      assert not constraints.sphere.check(data).any()
  
      data = safe_normalize(data)
      actual = constraints.sphere.check(data)
      assert actual.all()
      assert actual.shape == data.shape[:-1]
  
imports: import pytest
  import torch
  from pyro.distributions import constraints
  from pyro.ops.tensor_utils import safe_normalize
label_desc: Use image node_id 1 for calling a global function with example usage: test_sphere_check(dim) without return types