original_docstring: Yields data, expected value, and device for tensor conversion
          test.
  
          Stops earlier when no cuda device is available.
  
          
docstring: Yields data, expected value, and device for tensor conversion
  test.
  
  Stops earlier when no cuda device is available.
docstring_tokens: Yields data expected value and device for tensor conversion test . Stops earlier when no cuda device is available .
code: def parameters():
          """Yields data, expected value, and device for tensor conversion
          test.
  
          Stops earlier when no cuda device is available.
  
          """
          device = 'cpu'
          x = torch.zeros((5, 3)).float()
          y = torch.as_tensor([2, 2, 1])
          z = np.arange(15).reshape(5, 3)
          for X, expected in [
                  (x, x),
                  (y, y),
                  ([x, y], [x, y]),
                  ((x, y), (x, y)),
                  (z, torch.as_tensor(z)),
                  (
                      {'a': x, 'b': y, 'c': z},
                      {'a': x, 'b': y, 'c': torch.as_tensor(z)}
                  ),
                  (torch.as_tensor(55), torch.as_tensor(55)),
                  (pack_padded_sequence(x, y), pack_padded_sequence(x, y)),
          ]:
              yield X, expected, device
  
          if not torch.cuda.is_available():
              return
  
          device = 'cuda'
          x = x.to('cuda')
          y = y.to('cuda')
          for X, expected in [
                  (x, x),
                  (y, y),
                  ([x, y], [x, y]),
                  ((x, y), (x, y)),
                  (z, torch.as_tensor(z).to('cuda')),
                  (
                      {'a': x, 'b': y, 'c': z},
                      {'a': x, 'b': y, 'c': torch.as_tensor(z).to('cuda')}
                  ),
                  (torch.as_tensor(55), torch.as_tensor(55).to('cuda')),
                  (
                      pack_padded_sequence(x, y),
                      pack_padded_sequence(x, y).to('cuda')
                  ),
          ]:
              yield X, expected, device
code_tokens: def parameters ( ) : device = 'cpu' x = torch . zeros ( ( 5 , 3 ) ) . float ( ) y = torch . as_tensor ( [ 2 , 2 , 1 ] ) z = np . arange ( 15 ) . reshape ( 5 , 3 ) for X , expected in [ ( x , x ) , ( y , y ) , ( [ x , y ] , [ x , y ] ) , ( ( x , y ) , ( x , y ) ) , ( z , torch . as_tensor ( z ) ) , ( { 'a' : x , 'b' : y , 'c' : z } , { 'a' : x , 'b' : y , 'c' : torch . as_tensor ( z ) } ) , ( torch . as_tensor ( 55 ) , torch . as_tensor ( 55 ) ) , ( pack_padded_sequence ( x , y ) , pack_padded_sequence ( x , y ) ) , ] : yield X , expected , device if not torch . cuda . is_available ( ) : return device = 'cuda' x = x . to ( 'cuda' ) y = y . to ( 'cuda' ) for X , expected in [ ( x , x ) , ( y , y ) , ( [ x , y ] , [ x , y ] ) , ( ( x , y ) , ( x , y ) ) , ( z , torch . as_tensor ( z ) . to ( 'cuda' ) ) , ( { 'a' : x , 'b' : y , 'c' : z } , { 'a' : x , 'b' : y , 'c' : torch . as_tensor ( z ) . to ( 'cuda' ) } ) , ( torch . as_tensor ( 55 ) , torch . as_tensor ( 55 ) . to ( 'cuda' ) ) , ( pack_padded_sequence ( x , y ) , pack_padded_sequence ( x , y ) . to ( 'cuda' ) ) , ] : yield X , expected , device
short_docstring: Yields data, expected value, and device for tensor conversion
  test.
short_docstring_tokens: Yields data expected value and device for tensor conversion test .
comment: """Yields data, expected value, and device for tensor conversion
          test.
  
          Stops earlier when no cuda device is available.
  
          """