我正在尝试通过跟随卷积神经网络教程学习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.py并data_batch_1.bin从中提取文件cifar-10-binary.tar.gz.
通常,我可以使用它的eval()方法观察张量.但在这种情况下,它持续运行的时间比以往任何时候都长(我等了将近一个小时,它仍在运行).我的代码中有什么问题吗?
我正在使用 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。
我正在尝试使用 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. 有没有办法解决这个问题,或者是否有更好的方法来设计类构造函数?