engines.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:keras-gp 作者: alshedivat 项目源码 文件源码
def push(self, name, var):
        # Convert np.ndarrays into matlab.doubles and push into the workspace
        if type(var) is np.ndarray:
            self._eng.workspace[name] = self._matarray(var.tolist())
        elif type(var) is dict:
            var_copy = var.copy()
            for k, v in var_copy.iteritems():
                if type(v) is np.ndarray:
                    var_copy[k] = self._matarray(v.tolist())
            self._eng.workspace[name] = var_copy
        elif type(var) in {list, int, float}:
            self._eng.workspace[name] = var
        else:
            raise ValueError("Unknown type (%s) variable being pushed "
                             "into the MATLAB session." % type(var))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号