我有一台配备 AMD 处理器的 MacBook Pro,我想在这个 GPU 中运行 Keras(Tensorflow 后端)。我开始知道 Keras 只适用于 NVIDIA GPU。解决方法是什么(如果可能)?
我知道在 Android Studio 4.1+ 中已经引入了一个嵌入式模拟器。我看不到启用它的选项。
我做了什么:
implementation 'com.google.android.material:material:1.1.0'在依赖项中Theme.MaterialComponents.Light.Bridge为应用主题的父级 <style name="AppTheme" parent="Theme.MaterialComponents.Light.Bridge">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
Run Code Online (Sandbox Code Playgroud)
MaterialDatePicker.Builder<Pair<Long, Long>> builder = MaterialDatePicker.Builder.dateRangePicker();
Calendar now = Calendar.getInstance();
now.set(Calendar.YEAR, 2020);
now.set(Calendar.MONTH, 1);
now.set(Calendar.DAY_OF_MONTH, 10);
long first = now.getTimeInMillis();
now.set(Calendar.YEAR, 2020);
now.set(Calendar.MONTH, 5);
now.set(Calendar.DAY_OF_MONTH, 20);
long last = now.getTimeInMillis();
builder.setSelection(new Pair<>(first, last));
MaterialDatePicker<Pair<Long, Long>> picker = builder.build();
picker.show(fragmentActivity.getSupportFragmentManager(), "RangePicker");
Run Code Online (Sandbox Code Playgroud)
当我运行代码时,出现此错误
java.lang.IllegalArgumentException: com.google.android.material.datepicker.MaterialDatePicker
requires a value for the com.example:attr/materialCalendarFullscreenTheme attribute to be set
in your app …Run Code Online (Sandbox Code Playgroud) 由于 Pytorch GPU 对苹果芯片的支持刚刚发布,我尝试使用以下链接中的步骤安装 PyTorch。截至目前,只有夜间版本可用,所以我安装了它。但是,当我运行以下代码时,出现错误。
from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.optim.lr_scheduler import StepLR
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1, 32, 3, 1)
self.conv2 = nn.Conv2d(32, 64, 3, 1)
self.dropout1 = nn.Dropout(0.25)
self.dropout2 = nn.Dropout(0.5)
self.fc1 = nn.Linear(9216, 128)
self.fc2 = nn.Linear(128, 10)
def forward(self, x):
x = self.conv1(x)
x = F.relu(x)
x …Run Code Online (Sandbox Code Playgroud) 当我尝试在 Android Studio 3.5 中搜索插件时,无论我搜索什么插件,它都会加载然后给出“无结果”。它在市场上没有显示任何东西。
我在build.gradle中有这个
dependencies {
...
...
implementation 'com.github.bumptech.glide:glide:3.8.0'
//getting conflict after adding this library
implementation 'com.google.android.libraries.places:places:1.0.0'
}
Run Code Online (Sandbox Code Playgroud)
我不知道为什么Cannot resolve com.bumptech.glide.request.animation.GlideAnimation 从Google添加位置库后出现此错误。当我删除此没有问题。
初始化posenet
const net = await posenet.load();
const pose = await net.estimateSinglePose(videoElement, {
flipHorizontal: false
});
Run Code Online (Sandbox Code Playgroud)
输出
part: "leftEye"
position: {x: 0, y: 0}
score: 0.9931495785713196
Run Code Online (Sandbox Code Playgroud)
我的问题是,即使分数很高,我的每个身体部位也总是得到位置 0,0。
我有一台配备 M1 Max 处理器的 MacBook Pro,我想在该 GPU 上运行 Tensorflow。我已按照https://developer.apple.com/metal/tensorflow-plugin中的步骤进行操作,但我不知道为什么它在我的 GPU 上运行速度较慢。我使用谷歌官方页面的MNIST 教程进行了测试)。
import tensorflow as tf
import tensorflow_datasets as tfds
DISABLE_GPU = False
if DISABLE_GPU:
try:
# Disable all GPUS
tf.config.set_visible_devices([], 'GPU')
visible_devices = tf.config.get_visible_devices()
for device in visible_devices:
assert device.device_type != 'GPU'
except:
# Invalid device or cannot modify virtual devices once initialized.
pass
print(tf.__version__)
(ds_train, ds_test), ds_info = tfds.load('mnist', split=['train', 'test'], shuffle_files=True, as_supervised=True,
with_info=True)
def normalize_img(image, label):
return tf.cast(image, tf.float32) / 255., label …Run Code Online (Sandbox Code Playgroud) android ×2
amd-gpu ×1
datepicker ×1
keras ×1
material-components-android ×1
plaidml ×1
pyopencl ×1
python ×1
pytorch ×1
tensorflow ×1