You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by JinTian via Apache TVM Discuss <no...@discuss.tvm.ai> on 2022/03/24 02:37:53 UTC

[Apache TVM Discuss] [Questions] How to copy data to a fp16 DLTensor?


Hi, I have a DLTensor which malloc like this:

```
int dtype_code = kDLFloat;
  int dtype_bits_16 = 16;
  int dtype_lanes = 1;
  int device_type = kDLCPU;
  int device_id = 0;

  int64_t shape_coff[2] = {batch, 4};

  TVMArrayAlloc(shape_coff, 2, dtype_code, dtype_bits_16, dtype_lanes,
                device_type, device_id, &coeff);
```

How should I write data into this memory field? My data is calculate from float,
if using float assign values, the values readout is wrong.

I am confused on how to write data to a fp16 Tensor? Does anybody knows how?





---
[Visit Topic](https://discuss.tvm.apache.org/t/how-to-copy-data-to-a-fp16-dltensor/12397/1) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/5d618d05755a23c51887ba1f5dfaf148ead2deb571db540705ffa9475dfe92e0).