小编hsc*_*hsc的帖子

Tensorflow的Session.run()/ Tensor.eval()运行了很长时间

我正在尝试通过跟随卷积神经网络教程学习tenforflow ,但是当我试图弄清楚如何cifar10_input.py从中加载数据时cifar-10-batches-bin,我遇到了一个问题,这个问题Tensor.eval()执行了很长时间或者在没有结果的情况下永远运行.代码是这样的:

import tensorflow as tf
from tensorflow.models.image.cifar10 import cifar10_input

filenames = ['/Users/me/Downloads/cifar-10-batches-bin/data_batch_1.bin']
filename_queue = tf.train.string_input_producer(filenames)
read_input = cifar10_input.read_cifar10(filename_queue)
reshaped_image = tf.cast(read_input.uint8image, tf.float32)

with tf.Session() as sess:
    print reshaped_image.eval()
Run Code Online (Sandbox Code Playgroud)

代码基本上来自cifar10_input.pydata_batch_1.bin从中提取文件cifar-10-binary.tar.gz.

通常,我可以使用它的eval()方法观察张量.但在这种情况下,它持续运行的时间比以往任何时候都长(我等了将近一个小时,它仍在运行).我的代码中有什么问题吗?

python tensorflow

5
推荐指数
1
解决办法
1482
查看次数

如何使用 springboot 1.5.x 配置“hibernate.integrator_provider”

我正在使用 springboot 1.5.x 并尝试按照教程实现事件侦听器。

我遇到的阻碍是我不能用SpringBoot 1.5.x设置hibernate integrator?我试图properties.yml像下面的代码一样配置积分器,但它抛出了一个无法将字符串转换为积分器的异常:

spring:
  jpa:
    properties:
      hibernate.integrator_provider: com.xxxxx.RootAwareEventListenerIntegrator
Run Code Online (Sandbox Code Playgroud)

是一个相关的问题,但提供的解决方案不适用于 springBoot 1.5.x。

hibernate jpa spring-boot

4
推荐指数
1
解决办法
1792
查看次数

参数的 Python 类型可以是 None

我正在尝试使用 python 类型注释创建树结构。代码是这样的:

from typing import List

class TNode:
    def __init__(self, parent: 'TNode', data: str, children: List['TNode'] = []):
        self.parent = parent
        self.data = data
        self.children = children


root = TNode(None, 'example')
Run Code Online (Sandbox Code Playgroud)

但是代码存在类型不匹配的问题,Pycharm 会引发Expected type 'TNode', got 'None' instead. 有没有办法解决这个问题,或者是否有更好的方法来设计类构造函数?

python python-typing

1
推荐指数
1
解决办法
1071
查看次数

标签 统计

python ×2

hibernate ×1

jpa ×1

python-typing ×1

spring-boot ×1

tensorflow ×1