Ejemplo n.º 1
0
  def node_init(self):
    tuple_t = repeat_tuple(Int64, self.rank)

    self.shape_t = tuple_t
    self.strides_t = tuple_t
    self.ptr_t = ptr_type(self.elt_type)
    self._fields_ = [
      ('data', self.ptr_t),
      ('shape', tuple_t),
      ('strides', tuple_t),
      ('offset', Int64),
      ('total_elts', Int64)
    ]
Ejemplo n.º 2
0
  def node_init(self):
    assert isinstance(self.elt_type, ScalarT), \
      "Can't create array with element type %s, currently only scalar elements supported" % \
      (self.elt_type,)
        
    tuple_t = repeat_tuple(Int64, self.rank)

    self.shape_t = tuple_t
    self.strides_t = tuple_t
    self.ptr_t = ptr_type(self.elt_type)
    self._fields_ = [
      ('data', self.ptr_t),
      ('shape', tuple_t),
      ('strides', tuple_t),
      ('offset', Int64),
      ('size', Int64),
      # ('dtype', TypeValueT(self.elt_type))
    ]
Ejemplo n.º 3
0
    def __init__(self, elt_type, rank):
        assert isinstance(elt_type, ScalarT), \
          "Can't create array with element type %s, currently only scalar elements supported" % \
          (elt_type,)
        self.elt_type = elt_type
        self.rank = rank

        tuple_t = repeat_tuple(Int64, self.rank)

        self.shape_t = tuple_t
        self.strides_t = tuple_t
        self.ptr_t = ptr_type(self.elt_type)
        self._fields_ = [
            ('data', self.ptr_t),
            ('shape', tuple_t),
            ('strides', tuple_t),
            ('offset', Int64),
            ('size', Int64),
            # ('dtype', TypeValueT(self.elt_type))
        ]
        self._hash = hash((elt_type, rank))