我正在运行部署到azure webapp的机器人.机器人在本地调试中运行良好,并且在Azure门户中的Web测试客户端中运行良好.
我可以从bot框架模拟器连接到bot,我可以从浏览器访问其默认的html首页,但是当我向REST api发送消息时,它会返回以下错误.
我对状态代码"PaymentRequired"感到困惑.根据堆栈跟踪,我无法弄清楚它来自何处.我的机器人处于S1标准定价层.当我访问App Service Plan刀片时,它说我在Default0(Free:0 Small)计划中.当我访问Change App Service Plan时,它说"找不到应用服务计划".对于它的价值,我不认为这是一个LUIS问题,因为当我从其他客户端连接时,LUIS工作正常.
Buffer="{
"message": "An error has occurred.",
"exceptionMessage": "Operation returned an invalid status code 'PaymentRequired'",
"exceptionType": "Microsoft.Bot.Connector.ErrorResponseException",
"stackTrace":
" at Microsoft.Bot.Connector.Conversations.<ReplyToActivityWithHttpMessagesAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Connector.ConversationsExtensions.<ReplyToActivityAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.AlwaysSendDirect_BotToUser.<Microsoft-Bot-Builder-Dialogs-Internals-IBotToUser-PostAsync>d__4.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\ConnectorEx\BotToUser.cs:line 124
--- End of stack …Run Code Online (Sandbox Code Playgroud) 我想定义一个受歧视联盟的所有成员共享的方法.目前我已经像这样实现了它,但它看起来真的很不雅 - 当然还有更好的方法.建议?
type A =
{AData:string}
member this.SharedMethod (x:float) : int= ...
type B =
{BData:float}
member this.SharedMethod (x:float) : int= ...
type AB =
| A of A
| B of B
let CallSharedMethod (ab:AB) x =
match ab with
| AB.A(a') -> a'.SharedMethod x
| AB.B(b') -> b'.SharedMethod x
Run Code Online (Sandbox Code Playgroud) 我想在F#中实现此处描述的解决方案: 从具有相同方法名称的多个接口继承
具体来说,在F#中,如何实现两个接口之间共享同名的接口函数的实现?
这是C#解决方案:
public interface ITest {
void Test();
}
public interface ITest2 {
void Test();
}
public class Dual : ITest, ITest2
{
void ITest.Test() {
Console.WriteLine("ITest.Test");
}
void ITest2.Test() {
Console.WriteLine("ITest2.Test");
}
}
Run Code Online (Sandbox Code Playgroud) 是否有更惯用的方式来表达F#中的这种模式:
seq {
for item1 in list1 do
for item2 in list2 do
yield f(item1,item2)
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
我有一个有区别的联合类型:
type F =
| A of int
| B of float
Run Code Online (Sandbox Code Playgroud)
假设我有一个已经过滤的F列表,只生成A类对象:
let listOfAs=list.filter (fun f -> match f with | A(f') -> true | _ -> false)
Run Code Online (Sandbox Code Playgroud)
如何处理结果列表F而不需要在我的代码中到处都是模式匹配?编译器不喜欢直接强制转换,例如
list.map (fun f -> int f) listOfAs
Run Code Online (Sandbox Code Playgroud) 我想对一个序列进行分组,然后获取组中每个元素第一次出现的位置。当我尝试这个时
\n\nSeq.groupBy\xc2\xa0f\xc2\xa0inSeq\n|> Seq.map (fun (k,s) -> (k,s|>Seq.take 1|>Seq.exactlyOne))\nRun Code Online (Sandbox Code Playgroud)\n\n我发现有时\xc2\xa0会从\xc2\xa0s中得到不同的元素。这是预期的吗?
\n我有一个使用 http.server 的小型演示页面。我尝试与同事共享,但发现 http.server 在任何打开的连接上仍然被阻止,因此无法为并发用户提供服务。有没有办法运行 http.server 来处理并发连接?我在这里没有发现任何有用的东西:https ://docs.python.org/3/library/http.server.html
我在这里使用keras seq2seq示例:https : //github.com/keras-team/keras/blob/master/examples/lstm_seq2seq.py
我希望保留词汇表和解码器,以便以后可以再次加载它并将其应用于新序列。
尽管代码调用了model.save(),但这还不够,因为我可以看到解码设置引用了许多其他变量,这些变量是已训练模型的深层指针:
encoder_model = Model(encoder_inputs, encoder_states)
decoder_state_input_h = Input(shape=(latent_dim,))
decoder_state_input_c = Input(shape=(latent_dim,))
decoder_states_inputs = [decoder_state_input_h, decoder_state_input_c]
decoder_outputs, state_h, state_c = decoder_lstm(
decoder_inputs, initial_state=decoder_states_inputs)
decoder_states = [state_h, state_c]
decoder_outputs = decoder_dense(decoder_outputs)
decoder_model = Model(
[decoder_inputs] + decoder_states_inputs,
[decoder_outputs] + decoder_states)
Run Code Online (Sandbox Code Playgroud)
我想翻译此代码,以确定从磁盘加载的模型中的encoder_inputs,encoder_states,latent_dim,decoder_inputs。可以假设我事先知道模型架构是可以的。有没有简单的方法可以做到这一点?
更新:我在使用解码器构造代码并根据需要提取层输入/输出方面取得了一些进展。
encoder_inputs = model.input[0] #input_1
decoder_inputs = model.input[1] #input_2
encoder_outputs, state_h_enc, state_c_enc = model.layers[2].output # lstm_1
_, state_h_dec, state_c_dec = model.layers[3].output # lstm_2
decoder_outputs = model.layers[4].output # dense_1
encoder_states = [state_h_enc, state_c_enc]
encoder_model = …Run Code Online (Sandbox Code Playgroud) 假设我有一个linq表达式,它返回一系列IEnumerables.如何将它们连接成一个单独的IEnumerable?Concat似乎仅限于一次只合并两个.
我正在一个非常大的列表上运行List.scan以计算运行总计.当我完成后,我需要除了扫描输出之外的总数,以便非均匀地划分列表.总数是扫描的最后一个状态输出,我真的想避免额外遍历列表以获得最终状态.我能想到的唯一方法就是传递一个可变引用来累积总数.有没有更好的方法来解决这个问题?
let l = <very large list of int64>
let runningTotal=List.scan (fun s x -> x+s) 0L l
let total= <last element of runningTotal- very inefficient>
doSomething total runningTotal
Run Code Online (Sandbox Code Playgroud) 当我git checkout -b /dev/myfeature在Windows中执行该命令时,git bash返回此错误:
fatal: 'C:/Program Files/Git/dev/myfeature' is not a valid branch name.
我究竟做错了什么?
f# ×6
.net ×2
inheritance ×2
python ×2
azure ×1
botframework ×1
casting ×1
downcast ×1
git ×1
http ×1
httpserver ×1
keras ×1
linq ×1
list ×1
sequences ×1
tensorflow ×1