class_docstr: A mix-in class for storing tensors as properties with helper methods.
docstr: Args:
      dtype: data type to set for the inputs
      device: Device (as str or torch.device)
      kwargs: any number of keyword arguments. Any arguments which are
          of type (float/int/list/tuple/tensor/array) are broadcasted and
          other keyword arguments are set as attributes.
docstr_tok: ["Args",":","dtype",":","data","type","to","set","for","the","inputs","device",":","Device","(","as","str","or","torch.device",")","kwargs",":","any","number","of","keyword","arguments",".","Any","arguments","which","are","of","type","(","float\/int\/list\/tuple\/tensor\/array",")","are","broadcasted","and","other","keyword","arguments","are","set","as","attributes","."]
code: def __init__(
      self,
      dtype: torch.dtype = torch.float32,
      device: Device = "cpu",
      **kwargs,
  ) -> None:
      """
      Args:
          dtype: data type to set for the inputs
          device: Device (as str or torch.device)
          kwargs: any number of keyword arguments. Any arguments which are
              of type (float/int/list/tuple/tensor/array) are broadcasted and
              other keyword arguments are set as attributes.
      """
      super().__init__()
      self.device = make_device(device)
      self._N = 0
      if kwargs is not None:
          # broadcast all inputs which are float/int/list/tuple/tensor/array
          # set as attributes anything else e.g. strings, bools
          args_to_broadcast = {}
          for k, v in kwargs.items():
              if v is None or isinstance(v, (str, bool)):
                  setattr(self, k, v)
              elif isinstance(v, BROADCAST_TYPES):
                  args_to_broadcast[k] = v
              else:
                  msg = "Arg %s with type %r is not broadcastable"
                  warnings.warn(msg % (k, type(v)))
  
          names = args_to_broadcast.keys()
          # convert from type dict.values to tuple
          values = tuple(v for v in args_to_broadcast.values())
  
          if len(values) > 0:
              broadcasted_values = convert_to_tensors_and_broadcast(
                  *values, device=device
              )
  
              # Set broadcasted values as attributes on self.
              for i, n in enumerate(names):
                  setattr(self, n, broadcasted_values[i])
                  if self._N == 0:
                      self._N = broadcasted_values[i].shape[0]
  
imports: import copy
  import inspect
  import warnings
  from typing import Any, List, Optional, Tuple, TypeVar, Union
  import numpy
  import torch
  import torch.nn
  from ..common.datatypes import Device, make_device
label_desc: Use image node_id 1 to create a new TensorProperties object from inherited base classes: nn with example: obj = TensorProperties(dtype, device)