我在导入时不断收到以下错误:
ImportError: cannot import name 'experimental_functions_run_eagerly' from 'tensorflow.python.eager.def_function'
Run Code Online (Sandbox Code Playgroud)
我已经尝试使用pip卸载并重新安装tensorflow。
当我尝试导入张量流时发生错误,但以下是所有错误:
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import cv2
import tensorflow as tf
from tf import keras
Run Code Online (Sandbox Code Playgroud)
我Python 3.7.9在 Windows 10 上运行。由于错误,我无法导入 Tensorflow,但根据pip list这些是我的安装版本:
jupyter_client 7.4.7
jupyter_core 4.11.2
jupyter-server 1.23.2
jupyterlab 3.5.0
jupyterlab-pygments 0.2.2
jupyterlab_server 2.16.3
jupyterthemes 0.20.0
keras 2.11.0
tensorboard 2.11.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.1
tensorflow 2.11.0
tensorflow-cpu 2.11.0
tensorflow-estimator 2.11.0
tensorflow-intel 2.11.0 …Run Code Online (Sandbox Code Playgroud) 我目前正在为游戏开发 UDP 服务器。在此服务器中,使用 aByteArrayInputStream和ObjectInputStreamevery tick 将序列化字节转换为对象。为流创建一个变量并在程序关闭时关闭它们一次是否更有效?
像这样:
class Main {
private static ByteArrayInputStream byteIn;
private static ObjectInputStream objectIn;
public static void main(String[] args) {
while(true){
receive();
}
//when program is done call close();
}
public static void receive(){
byteIn = new ByteArrayInputStream();
objectIn = new ObjectInputStream(new BufferedInputStream(byteIn));
//do something
}
public static void close(){
objectIn.close();
byteIn.close();
}
}
Run Code Online (Sandbox Code Playgroud)
或者每次创建和关闭新流是否更有效?
像这样:
class Main {
public static void main(String[] args) {
while(true){
receive();
}
}
public static void …Run Code Online (Sandbox Code Playgroud) java inputstream outputstream objectoutputstream bytearrayinputstream