I found in wiki 
[link](https://en.wikipedia.org/wiki/Row-_and_column-major_order), that by 
definition, a row-major tensor should have decreased strides.

So, `A` or `B` here can either be row-major or column-major, that's why we need 
`IsInPlaceTransposed `. (Although in tvm, tensors are most commonly stored in 
row-major.)

Finally I understand that my confusion actually comes from the necessity of the 
arguments `transa` and `transb` in 
[./python/tvm/contrib/cblas.py](https://github.com/apache/incubator-tvm/blob/master/python/tvm/contrib/cblas.py).

Since `A` is `DLTensor*`, I think `transa` can be determined by A->strides:

1. if A->strides[0] > A->strides[1], `A` is inferred to be row major, 
transa=False.

2. otherwise, `A` is inferred to be column major, transa=True.

So as to `transb`.


PS.

But In c interface of the `Cblas` package as follows:
```
void cblas_sgemm(const CBLAS_LAYOUT Layout, const CBLAS_TRANSPOSE TransA,
                               const CBLAS_TRANSPOSE TransB, const MKL_INT M, 
const MKL_INT N,
                               const MKL_INT K, const float alpha, const float 
*A,
                               const MKL_INT lda, const float *B, const MKL_INT 
ldb,
                               const float beta, float *C, const MKL_INT ldc) 
NOTHROW;
```
we need `TransA` and `TransB` here because `A` and `B` here are just pointers 
instead of `DLTensor*`, there is no clue whether `A` is column-major or 
row-major.





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/is-increased-strided-dltensor-stored-in-column-major/7995/2)
 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/f92943df02fe3e28dc772106fb44b21f3b379675875ff3aea763c29da6fb8edd).

Reply via email to