我目前正在将一些 Python 翻译成 F#,特别是神经网络和深度学习。
为了确保正确转换数据结构,需要 Python 中嵌套类型的详细信息。该类型()函数工作简单类型而不是嵌套类型。
例如在 Python 中:
> data = ([[1,2,3],[4,5,6],[7,8,9]],["a","b","c"])
> type(data)
<type 'tuple'>
只给出第一级的类型。对元组中的数组一无所知。
我希望像 F# 那样做
> let data = ([|[|1;2;3|];[|4;5;6|];[|7;8;9|]|],[|"a";"b";"c"|]);;
val data : int [] [] * string [] =
  ([|[|1; 2; 3|]; [|4; 5; 6|]; [|7; 8; 9|]|], [|"a"; "b"; "c"|])
返回独立于值的签名
int[][]*字符串[]
Run Code Online (Sandbox Code Playgroud)* is a tuple item separator int [] [] is a two dimensional jagged array of int string [] is a one dimensional array of …