1 import grain.cuda.allocator : CuTensor; 2 import grain.ops.transposed : transposed; 3 import grain.testing : assertEqual; 4 5 auto x = CuTensor!(3, float)(2, 3, 4).transposed; 6 auto t = x.makeCudnnTensor; 7 8 cudnnDataType_t dtype; 9 int dim; 10 int[3] shape; 11 int[3] strides; 12 cudnnGetTensorNdDescriptor(t.desc, 3, &dtype, &dim, shape.ptr, strides.ptr); 13 assert(dtype == CUDNN_DATA_FLOAT); 14 assertEqual(dim, 4, "dim < 4 will be 4"); 15 assert(shape == x.shape); 16 assert(strides == x.strides);
convert variable to cudnn tensor discriptor object