3dba9054b3c7bf4b9edabb430eb457a07e05b6ca,tensorly/mps_tensor.py,,mps_to_tensor,#Any#,8

Before Change


                   tensor whose MPS decomposition was given by "factors"
    

    n_mode_dimensions = mps_get_n_mode_dimensions(factors)

    D = len(n_mode_dimensions)

    (r0, n1, r1) = factors[0].shape
    output_tensor = factors[0]
    output_tensor = tl.reshape(output_tensor, (n1, r1))

    for k in range(1, D):

        (r_prev, n_k, r_k) = factors[k].shape
        G_k = tl.reshape(factors[k], (r_prev, n_k * r_k))

        output_tensor = tl.dot(output_tensor, G_k)
        output_tensor = tl.reshape(output_tensor, (-1, r_k))

    output_tensor = tl.reshape(output_tensor, n_mode_dimensions)

    return output_tensor

After Change


    output_tensor: ndarray
                   tensor whose MPS/TT decomposition was given by "factors"
    
    full_shape = [f.shape[1] for f in factors]
    full_tensor = tl.reshape(factors[0], (full_shape[0], -1))

    for factor in factors[1:]:
        rank_prev, _, rank_next = factor.shape
        factor = tl.reshape(factor, (rank_prev, -1))
        full_tensor = tl.dot(full_tensor, factor)
        full_tensor = tl.reshape(full_tensor, (-1, rank_next))

    return tl.reshape(full_tensor, full_shape)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 11

Instances


Project Name: tensorly/tensorly
Commit Name: 3dba9054b3c7bf4b9edabb430eb457a07e05b6ca
Time: 2018-07-05
Author: jean.kossaifi@gmail.com
File Name: tensorly/mps_tensor.py
Class Name:
Method Name: mps_to_tensor


Project Name: GoogleCloudPlatform/PerfKitBenchmarker
Commit Name: 37bb2945cc38af48dfa5ad09392736c427008a80
Time: 2015-12-09
Author: connormccoy@google.com
File Name: perfkitbenchmarker/linux_benchmarks/redis_benchmark.py
Class Name:
Method Name: Run


Project Name: sony/nnabla
Commit Name: ffdd950970c5953e351fa88795fe916b3465d813
Time: 2018-06-13
Author: Yukio.Oobuchi@sony.com
File Name: python/src/nnabla/utils/data_source_implements.py
Class Name: CacheDataSource
Method Name: _get_data