Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 使用具有tensorflow对象的元组创建类对象_Python 3.x_Oop_Tensorflow_Low Level Api - Fatal编程技术网

Python 3.x 使用具有tensorflow对象的元组创建类对象

Python 3.x 使用具有tensorflow对象的元组创建类对象,python-3.x,oop,tensorflow,low-level-api,Python 3.x,Oop,Tensorflow,Low Level Api,我有一个ParametersData类,它创建了如下神经网络: class parametersTheta: def __init__(self, weight1, weight2,....): self.weightName1 = weight1 self.weightName2 = weight2 ... self.sess = tf.Session() def makeWorkerTheta(self, par

我有一个ParametersData类,它创建了如下神经网络:

class parametersTheta:
    def __init__(self, weight1, weight2,....):
        self.weightName1 = weight1
        self.weightName2 = weight2
        ...
        self.sess = tf.Session()
    def makeWorkerTheta(self, param):
        return parametersTheta(self.sess.run(functionCalculatingTensorWeights, feed_dict={...}))
self.sess.run创建所有权重张量的元组。但是,会弹出一个错误,说明您需要输入weight2及其后的值,即元组进入weight1


我怎样才能解决这个问题?基本上,我如何创建具有元组的类参数TA的实例?

您可以使用扩展为如下参数的元组实例化类

parametersTheta(*(weight1, weight2, ...))
元组前的星号将其展开为相应的参数列表