Ejemplo n.º 1
0
 def __init__(self, axis=0, prepend=None, append=None):
     if prepend is not None:
         prepend = cde.Tensor(np.array(prepend))
     if append is not None:
         append = cde.Tensor(np.array(append))
     super().__init__(axis, prepend, append)
Ejemplo n.º 2
0
 def __init__(self, fill_value):
     super().__init__(cde.Tensor(np.array(fill_value)))
Ejemplo n.º 3
0
 def __init__(self, operator, constant, dtype=mstype.bool_):
     dtype = mstype_to_detype(dtype)
     constant = cde.Tensor(np.array(constant))
     super().__init__(DE_C_RELATIONAL[operator], constant, dtype)
Ejemplo n.º 4
0
 def __init__(self, pad_shape, pad_value=None):
     if pad_value is not None:
         pad_value = cde.Tensor(np.array(pad_value))
     super().__init__(cde.TensorShape(pad_shape), pad_value)
Ejemplo n.º 5
0
def test_basic():
    x = np.array([["ab", "cde", "121"], ["x", "km", "789"]], dtype='S')
    n = cde.Tensor(x)
    arr = n.as_array()
    np.testing.assert_array_equal(x, arr)
Ejemplo n.º 6
0
 def __init__(self, axis=0, prepend=None, append=None):
     self.axis = axis
     self.prepend = cde.Tensor(
         np.array(prepend)) if prepend is not None else prepend
     self.append = cde.Tensor(
         np.array(append)) if append is not None else append
Ejemplo n.º 7
0
 def __init__(self, pad_shape, pad_value=None):
     self.pad_shape = cde.TensorShape(pad_shape)
     self.pad_value = cde.Tensor(
         np.array(pad_value)) if pad_value is not None else pad_value
Ejemplo n.º 8
0
 def __init__(self, operator, constant, dtype=mstype.bool_):
     self.operator = operator
     self.dtype = mstype_to_detype(dtype)
     self.constant = cde.Tensor(np.array(constant))
Ejemplo n.º 9
0
 def __init__(self, fill_value):
     self.fill_value = cde.Tensor(np.array(fill_value))