我在google colaboratory和git库TensorD中遇到问题。我想从 https://github.com/Large-Scale-Tensor-Decomposition/tensorD 但是我不能。我git克隆了库。
我git克隆了库。
!pip3 install git+https://github.com/Large-Scale-Tensor-Decomposition/tensorD.git
我也尝试过:
!git clone https://github.com/Large-Scale-Tensor-Decomposition/tensorD.git
!pip3 show tensorD
给予:
Name: tensorD
Version: 0.1
Summary: Tensor Decomposition via TensorFlow
Home-page: https://github.com/Large-Scale-Tensor-Decomposition/tensorD
Author: Jinmian Ye, Liyang Hao, Siqi Liang
Author-email: jinmian.y@gmail.com
License: MIT
Location: /usr/local/lib/python3.6/dist-packages
Requires: numpy, tensorflow
Required-by:
当我跑步时:
# import necessary packages
from tensorD.factorization.env import Environment
from tensorD.dataproc.provider import Provider
from tensorD.factorization.cp import CP_ALS
import tensorD.demo.DataGenerator as dg
# use synthetic_data_cp to generate a random tensor with shape of 40x40x40
X = dg.synthetic_data_cp([40, 40, 40], 10)
data_provider = Provider()
data_provider.full_tensor = lambda: X
env = Environment(data_provider, summary_path='/tmp/cp_demo_' + '30')
cp = CP_ALS(env)
# set rank=10 for decomposition
args = CP_ALS.CP_Args(rank=10, validation_internal=1)
# build decomposition model with arguments
cp.build_model(args)
# train decomposition model, set the max iteration as 100
cp.train(100)
# obtain factor matrices from trained model
factor_matrices = cp.factors
for matrix in factor_matrices:
print(matrix)
# obtain scaling vector from trained model
lambdas = cp.lambdas
print(lambdas)
我获得了:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-14-716b7dcb10ac> in <module>()
2 from tensorD.dataproc.provider import Provider
3 from tensorD.factorization.cp import CP_ALS
----> 4 import tensorD.demo.DataGenerator as dg
5
6 # use synthetic_data_cp to generate a random tensor with shape of 40x40x40
ModuleNotFoundError: No module named 'tensorD.demo'
即使存储库中有一个文件夹tensorD / demo。 我该怎么办?这是我第一次将git library导入google colaboratory。