10 #include <unordered_map>
25 if (A_shape.
size() != 2) {
29 int64_t m = A_shape[0], n = A_shape[1];
30 if (m == 0 || n == 0) {
32 "Tensor shapes should not contain dimensions with zero.");
49 if (device.IsSYCL()) {
50 #ifdef BUILD_SYCL_MODULE
51 SVDSYCL(A_data, U_data, S_data, VT_data, m, n, dtype, device);
55 }
else if (device.IsCUDA()) {
56 #ifdef BUILD_CUDA_MODULE
60 SVDCUDA(A_data, U_data, S_data, VT_data, superb_data, m, n, dtype,
68 SVDCPU(A_data, U_data, S_data, VT_data, superb_data, m, n, dtype,
#define AssertTensorDtypes(tensor,...)
When CUDA is not enabled, this is a dummy class.
Tensor Contiguous() const
Device GetDevice() const override
static Tensor Empty(const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0"))
Create a tensor with uninitialized values.
SizeVector GetShape() const
Tensor T() const
Expects input to be <= 2-D Tensor by swapping dimension 0 and 1.
void SVD(const Tensor &A, Tensor &U, Tensor &S, Tensor &VT)
void SVDCPU(const void *A_data, void *U_data, void *S_data, void *VT_data, void *superb_data, int64_t m, int64_t n, Dtype dtype, const Device &device)
void SVDSYCL(const void *A_data, void *U_data, void *S_data, void *VT_data, int64_t m, int64_t n, Dtype dtype, const Device &device)
void SVDCUDA(const void *A_data, void *U_data, void *S_data, void *VT_data, void *superb_data, int64_t m, int64_t n, Dtype dtype, const Device &device)
Generic file read and write utility for python interface.