我刚刚更新了我的显卡驱动器
sudo apt install nvidia-driver-470
sudo apt install cuda-drivers-470
Run Code Online (Sandbox Code Playgroud)
我决定以这种方式安装它们,因为它们在尝试时受到阻碍sudo apt upgrade
。然后我错误地sudo apt autoremove
清理了旧包。重新启动计算机以正确设置新驱动程序后,我无法再将 GPU 加速与 Tensorflow 结合使用。
import tensorflow as tf
tf.test.is_gpu_available()
WARNING:tensorflow:From <stdin>:1: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.config.list_physical_devices('GPU')` instead.
2021-12-07 16:52:01.771391: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA
To enable them in other …
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个 Material UI range Slider,它有两个值。如果我设置它就有效:
const [value, setValue] = React.useState([5,20]);
const [value, setValue] = React.useState([val]);
const handleChange = (event, newValue) => {
setValue(newValue);
};
return (
<div className={classes.root}>
<Typography id="range-slider" gutterBottom>
Temperature range
</Typography>
<Slider
value={value}
onChange={handleChange}
valueLabelDisplay="auto"
aria-labelledby="range-slider"
getAriaValueText={valuetext}
/>
<Input value={value} />
</div>
);
Run Code Online (Sandbox Code Playgroud)
但是,如果我设置一个值并将其分配给这样的 useState 常量,则它不起作用。即使有错误,我也不明白为什么:
var val = [5,20]
const [value, setValue] = React.useState([val])
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Warning: Failed prop type: Invalid prop `value` supplied to `ForwardRef(Slider)`.
in ForwardRef(Slider) (created by WithStyles(ForwardRef(Slider)))
in WithStyles(ForwardRef(Slider)) (at demo.js:32)
in div …
Run Code Online (Sandbox Code Playgroud)