我读报纸,它使用的术语冷缓存和温暖的高速缓存.我搜索了这个术语,但我没有找到有用的东西(这里只有一个帖子).
这些术语是什么意思?
在我将Android Studio更新到版本0.2.7之后,我收到以下错误:
org.gradle.tooling.GradleConnectionException: Could not execute build
using Gradle distribution
'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.: Could
not execute build using Gradle distribution
'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.
Run Code Online (Sandbox Code Playgroud)
这是我的build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
dependencies {
compile files('libs/android-support-v4.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 10
targetSdkVersion 17
}
}
Run Code Online (Sandbox Code Playgroud)
有谁知道这个错误?提前致谢!
将我的Android工作室更新为2.0并将gradle更新为2.0.0并将SDK-Platform更新为23.0.3当我想启动应用程序时,需要花费太多时间(约2-3秒)并在Android监视器中显示以下警告:
W/System: ClassLoader referenced unknown path: /data/app/net.hadifar.test-1/lib/arm
W/System: ClassLoader referenced unknown path: /data/app/net.hadifar.test-1/lib/arm
W/art: Suspending all threads took: 5.439ms
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
W/art: Suspending all threads took: 6.808ms
Run Code Online (Sandbox Code Playgroud)
但是第二次启动应用程序时,它会像往常一样运行.任何人都可以知道这是什么问题吗?
我在应用程序工具栏中的图标和导航图标(如图像中)之间得到了这个奇怪的边距.我不知道它来自何处以及如何将其删除.在搜索互联网后,我发现了这个:
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:minHeight="?attr/actionBarSize"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:background="?attr/colorPrimaryDark"
android:layout_margin="0dp"
android:contentInsetLeft="0dp"
android:contentInsetRight="0dp"
android:contentInsetStart="0dp"
android:contentInsetEnd="0dp"
android:padding="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"
app:contentInsetEnd="0dp">
</android.support.v7.widget.Toolbar>
Run Code Online (Sandbox Code Playgroud)
编辑>>解决方案
好吧,在使用布局绑定后,我认为很多边缘都是图标(如图所示).但是我仍然可以删除此边距并更改图标和标题文本的大小.
编辑
关注@Amir解决方案:java的助手:
class BasicActivity extends AppCompatActivity{
protected Toolbar mToolbar; /// Initilize it in onCreate methode
.....
protected void setupToolbar(String title) {
toolbar=(Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(true);
ab.setDisplayShowHomeEnabled(true);
}
if (!TextUtils.isEmpty(title)) {
setTitle(title);
}
}
}
Run Code Online (Sandbox Code Playgroud)
在你的活动课上:
class Main extends BasicActivity{
@override
protected void onCreate(Bundle saved){
super.onCreate(saved);
.... …
Run Code Online (Sandbox Code Playgroud) 对于应用程序,例如配对文本相似性,输入数据类似于:pair_1, pair_2
.在这些问题中,我们通常有多个输入数据.以前,我成功实现了我的模型:
model.fit([pair_1, pair_2], labels, epochs=50)
Run Code Online (Sandbox Code Playgroud)
我决定用tf.data API 替换我的输入管道.为此,我创建了一个类似于的数据集:
dataset = tf.data.Dataset.from_tensor_slices((pair_1, pair2, labels))
Run Code Online (Sandbox Code Playgroud)
它成功编译但是当开始训练时会引发以下异常:
AttributeError: 'tuple' object has no attribute 'ndim'
Run Code Online (Sandbox Code Playgroud)
我的Keras和Tensorflow版本分别是2.1.6
和1.11.0
.我在Tensorflow存储库中发现了类似的问题:
tf.keras多输入模型在使用tf.data.Dataset时不起作用.
有谁知道如何解决这个问题?
以下是代码的一些主要部分:
(q1_test, q2_test, label_test) = test
(q1_train, q2_train, label_train) = train
def tfdata_generator(sent1, sent2, labels, is_training):
'''Construct a data generator using tf.Dataset'''
dataset = tf.data.Dataset.from_tensor_slices((sent1, sent2, labels))
if is_training:
dataset = dataset.shuffle(1000) # depends on sample size
dataset = dataset.repeat()
dataset = dataset.prefetch(tf.contrib.data.AUTOTUNE)
return …
Run Code Online (Sandbox Code Playgroud) Google colab在运行时加速器中引入了TPU.我找到了一个例子,如何在官方Tensorflow github中使用TPU .但这个例子并不适用于Google-colaboratory.它停留在以下行:
tf.contrib.tpu.keras_to_tpu_model(model, strategy=strategy)
Run Code Online (Sandbox Code Playgroud)
当我在colab上打印可用设备时,它会返回[]
TPU加速器.有谁知道如何在colab上使用TPU?
我有使用keras 1.2
和的代码tensorflow 1.1
。我已经运行它但有错误
import numpy as np
import keras
from keras import backend as K
from keras import initializers
from keras.models import Sequential, Model, load_model, save_model
from keras.layers.core import Dense, Lambda, Activation
from keras.layers import Embedding, Input, Dense, Multiply, Reshape, Flatten
from keras.optimizers import Adagrad, Adam, SGD, RMSprop
from keras.regularizers import l2
from sklearn.metrics import average_precision_score
from sklearn.metrics import auc
def init_normal(shape, name=None):
return initializers.lecun_uniform(seed=None)
def get_model(num_a, num_b, num_c, dim, regs=[0,0,0]):
a = Input(shape=(1,), dtype='int32', name …
Run Code Online (Sandbox Code Playgroud) 如何计算tf-idf
查询?我理解如何使用以下定义计算一组文档的tf-idf:
tf =文档中的出现/文档中的总词数
idf = log(#documents/#documents,其中包含术语
但我不明白这与查询有何关联.
例如,我读了一个资源,说明了查询的值" life learning
"
生活| tf = .5 | idf = 1.405507153 | tf_idf = 0.702753576
学习| tf = .5 | idf = 1.405507153 | tf_idf = 0.702753576
tf
我理解的值,每个术语只出现在两个可能的术语中,因此1/2,但我不知道idf
它来自何处.
我认为#documents = 1和occurrence = 1,log(1)= 0,所以idf
将是0,但似乎并非如此.它是基于您使用的任何文件?你如何计算查询的tf-idf?
我想实施FloatingView
.这使活动调整大小和拖动(如下图).我也看到了这个帖子,并在此基础上创建了自己的帖子service
.(另请参见本&这个库)
问题是根据实现我不能继续视频,有时屏幕变黑,没有任何显示.我想知道处理这个问题的正确方法是什么?没有视频中断并继续播放.(我知道中断因为setOnPrepareListener
但是如何避免?)
这是我的代码:
public class FloatingStream extends Service implements FloatingViewListener {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (mFloatingViewManager != null) {
return START_STICKY;
}
final DisplayMetrics metrics = new DisplayMetrics();
final WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
windowManager.getDefaultDisplay().getMetrics(metrics);
floatingServiceBinder = new FloatingServiceBinder(this);
final View rootView = LayoutInflater.from(this).inflate(R.layout.view_exoplayer, null, false);
final VideoView videoView = (VideoView) rootView.findViewById(R.id.video_view);
videoView.setVideoURI(Uri.parse(MY_URL));
videoView.setOnPreparedListener(new OnPreparedListener() {
@Override
public void onPrepared() …
Run Code Online (Sandbox Code Playgroud) 将项目导入Android studio后,如果我想编译或运行该项目,则会抛出错误:
错误:(61,65)在源代码1.6中不支持java:diamond运算符
(使用-source 7或更高版本启用菱形运算符)
有谁知道它是什么以及如何解决它?
android ×5
keras ×3
tensorflow ×3
gradle ×2
caching ×1
ext2 ×1
filesystems ×1
linux-kernel ×1
margins ×1
python-2.7 ×1
search ×1
tf-idf ×1