class_docstr: Duck-typed version of PyG's GraphStore and FeatureStore.
class_docstr_tok: ["Duck-typed","version","of","PyG","'s","GraphStore","and","FeatureStore","."]
code: def _get_tensor(self, attr: CuGraphTensorAttr) -> TensorType:
      feature_backend = self.__features.backend
      cols = attr.properties
  
      idx = attr.index
      if idx is not None:
          if feature_backend == "torch":
              if not isinstance(idx, torch.Tensor):
                  raise TypeError(
                      f"Type {type(idx)} invalid"
                      f" for feature store backend {feature_backend}"
                  )
              idx = idx.cpu()
          elif feature_backend == "numpy":
              # allow feature indexing through cupy arrays
              if isinstance(idx, cupy.ndarray):
                  idx = idx.get()
              elif isinstance(idx, torch.Tensor):
                  idx = np.asarray(idx.cpu())
  
      if cols is None:
          t = self.__features.get_data(
              idx, attr.group_name, attr.attr_name
          )
          if idx is None:
              t = t[-1]
  
          if isinstance(t, np.ndarray):
              t = torch.as_tensor(t, device="cpu")
  
          return t
  
      else:
          t = self.__features.get_data(idx, attr.group_name, cols[0])
  
          if len(t.shape) == 1:
              t = torch.tensor([t])
  
          for col in cols[1:]:
              u = self.__features.get_data(idx, attr.group_name, col)
  
              if len(u.shape) == 1:
                  u = torch.tensor([u])
  
              t = torch.concatenate([t, u])
  
          return t
  
imports: from typing import Optional, Tuple, Any, Union, List, Dict
  from enum import Enum, auto
  from dataclasses import dataclass
  from collections import defaultdict
  from itertools import chain
  from functools import cached_property
  import numpy
  import cupy
  import pandas
  import cudf
  import cugraph
  import warnings
  import dask.array
  import dask.dataframe
  import dask.distributed
  import dask_cudf
  from cugraph.utilities.utils import import_optional, MissingModule
label_desc: Use image node_id 29 for calling the CuGraphStore obj's underlying member method code with example usage: obj._get_tensor(attr) and returns: t, t