我想用
catch(:Goal, +Catcher, :Recover)
Run Code Online (Sandbox Code Playgroud)
目标在哪里
call_with_time_limit(+Time, :Goal)
Run Code Online (Sandbox Code Playgroud)
它搞砸了,我无法找到正确的方法来了解上述情况之一发生时间:
1)由于超时,目标停止了.
2)目标失败(有时候会失败).
我试过了:
(catch(call_with_time_limit(Time, Goal), Catcher, Recover) ->
(ground(Catcher), Catcher = time_limit_exceeded), **TIMEOUT ACTIONS**)
;
(**SUCCESS ACTIONS**))
;
**FAILURE ACTIONS**
)
Run Code Online (Sandbox Code Playgroud)
*编辑*
图案:
我使用以下模式:
((catch(call_with_time_limit(6,goal),
Exception,
true),(var(Exception);Exception=time_limit_exceeded))
->
(var(Exception) -> writeln(succ) ; writeln(timeout))
;
writeln(fail)
).
Run Code Online (Sandbox Code Playgroud)
该模式在4秒或更长时间内不起作用 - 它只是忽略了超时请求.
我在训练神经网络批次与Keras 2.0包Python.以下是有关数据和培训参数的一些信息:
以下是以下代码的一些日志:
for i in range(epochs):
print("train_model:: starting epoch {0}/{1}".format(i + 1, epochs))
model.fit_generator(generator=batch_generator(data_train, target_train, batch_size),
steps_per_epoch=num_of_batches,
epochs=1,
verbose=1)
Run Code Online (Sandbox Code Playgroud)
(部分)日志:
train_model:: starting epoch 1/3
Epoch 1/1
1/406 [..............................] - ETA: 11726s - loss: 0.7993 - acc: 0.5996
2/406 [..............................] - ETA: 11237s - loss: 0.7260 - acc: 0.6587
3/406 [..............................] - ETA: 14136s - loss: 0.6619 - acc: 0.7279
404/406 [============================>.] - …Run Code Online (Sandbox Code Playgroud) 我试图在这里找到这个bug,但仍然没有得到它.我一直在调试和谷歌搜索并发现一些接近的主题,但只有解决方案,我不需要ATM,我很好奇为什么这个代码不起作用:
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#define BUFFER 256
int main()
{
int missionCode;
char *desc = (char*)malloc(sizeof(char)*BUFFER);
do {
printf("Please enter the mission code (or -1 for exit): ");
scanf("%d", &missionCode);
fflush(NULL);
if (missionCode==-1)
return 1;
} while (missionCode>10);
do {
printf("Please enter a string:\n");
scanf("%[^\n]s", desc); //it doesn't stop here!
fflush(NULL);
if (!strcmp("exit",desc))
return 1;
} while (strlen(desc)<20);
printf("your string:\n%s", desc);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
第二个循环中的scanf\flushall有问题,但我找不到什么.顺便说一句,这是C语言.
我希望得到1到10之间的随机数.它确实有效,但是当它处于循环中时,我并不真正得到随机数.
int randomNum;
srand ( (unsigned int)time(NULL) );
randomNum = rand() % 10;
Run Code Online (Sandbox Code Playgroud)
我已经花了几个小时在这里和谷歌寻找解决方案,但它看起来没有人真正解决它(或者我可能没有足够的搜索).我们从随机函数得到的值取决于秒(不是毫秒或其他东西,就像在其他编程语言中),这就是数字不是随机的原因.
另外,我不想下载C语言包,因为我在大学实验室运行我的代码,他们不会允许它.
有没有人有这个问题的创意解决方案?也许是一些数学函数?