示例#1
0
def test_double():
    obj = DataType(1)
    assert obj.toChar() == 'D'
    assert obj.toName() == 'double'
    assert obj.toEnum() == 'Double'
    assert obj.toOpenCL() == 'double'
    assert obj.toHIP() == 'double'
    assert obj.toDevice("") == 'double'
    assert obj.toCpp() == 'double'
    assert obj.getLibString() == 'tensileDataTypeDouble'
    assert obj.numBytes() == 8
    assert obj.isReal()
示例#2
0
def test_single():
    obj = DataType(0)
    assert obj.toChar() == 'S'
    assert obj.toName() == 'single'
    assert obj.toEnum() == 'Float'
    assert obj.toOpenCL() == 'float'
    assert obj.toHIP() == 'float'
    assert obj.toDevice("") == 'float'
    assert obj.toCpp() == 'float'
    assert obj.getLibString() == 'tensileDataTypeFloat'
    assert obj.numBytes() == 4
    assert obj.isReal()
示例#3
0
def test_complexDouble():
    obj = DataType(3)
    assert obj.toChar() == 'Z'
    assert obj.toName() == 'complexDouble'
    assert obj.toEnum() == 'ComplexDouble'
    assert obj.toOpenCL() == 'double2'
    assert obj.toHIP() == 'TensileComplexDouble'
    assert obj.toDevice("") == 'TensileComplexDouble'
    assert obj.toCpp() == 'TensileComplexDouble'
    assert obj.getLibString() == 'tensileDataTypeComplexDouble'
    assert obj.numBytes() == 16
    assert not obj.isReal()
示例#4
0
def test_complexSingle():
    obj = DataType(2)
    assert obj.toChar() == 'C'
    assert obj.toName() == 'complexSingle'
    assert obj.toEnum() == 'ComplexFloat'
    assert obj.toOpenCL() == 'float2'
    assert obj.toHIP() == 'TensileComplexFloat'
    assert obj.toDevice("") == 'TensileComplexFloat'
    assert obj.toCpp() == 'TensileComplexFloat'
    assert obj.getLibString() == 'tensileDataTypeComplexFloat'
    assert obj.numBytes() == 8
    assert not obj.isReal()
示例#5
0
def test_int32():
    obj = DataType(6)
    assert obj.toChar() == 'I'
    assert obj.toName() == 'int32'
    assert obj.toEnum() == 'Int32'
    assert obj.toOpenCL() == 'ERROR'
    assert obj.toHIP() == 'int32_t'
    assert obj.toDevice("OCL") == 'ERROR'
    assert obj.toDevice("") == 'int32_t'
    assert obj.toCpp() == 'TensileInt32'
    assert obj.getLibString() == 'tensileDataTypeInt32'
    assert obj.numBytes() == 4
    assert obj.isReal()
示例#6
0
def test_half():
    obj = DataType(4)
    assert obj.toChar() == 'H'
    assert obj.toName() == 'half'
    assert obj.toEnum() == 'Half'
    assert obj.toOpenCL() == 'ERROR'
    assert obj.toHIP() == 'tensile_half'
    assert obj.toDevice("OCL") == 'ERROR'
    assert obj.toDevice("") == 'tensile_half'
    assert obj.toCpp() == 'TensileHalf'
    assert obj.getLibString() == 'tensileDataTypeHalf'
    assert obj.numBytes() == 2
    assert obj.isReal()