考虑Haskell(GHC)中的隐式参数,我遇到了问题.我有一个函数f,它假定隐含参数x,并希望通过将f应用于g来将其封装在上下文中
f :: (?x :: Int) => Int -> Int
f n = n + ?x
g :: (Int -> Int) -> (Int -> Int)
g t = let ?x = 5 in t
Run Code Online (Sandbox Code Playgroud)
但是当我试图评估时
g f 10
Run Code Online (Sandbox Code Playgroud)
我得到一个x没有绑定的错误,例如:
Unbound implicit parameter (?x::Int)
arising from a use of `f'
In the first argument of `g', namely `f'
In the second argument of `($)', namely `g f 10'
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉我,我做错了什么?
(我试图让Haskell的WordNet接口工作 - …
我正在尝试使用 Keras (2.0.6) 和 TensorFlow 后端 (1.2.1) 来掩盖卷积 LSTM 层中的缺失数据:
import keras
from keras.models import Sequential
from keras.layers import Masking, ConvLSTM2D
n_timesteps = 10
n_width = 64
n_height = 64
n_channels = 1
model = Sequential()
model.add(Masking(mask_value = 0., input_shape = (n_timesteps, n_width, n_height, n_channels)))
model.add(ConvLSTM2D(filters = 64, kernel_size = (3, 3)))
Run Code Online (Sandbox Code Playgroud)
但是我收到以下 ValueError:
ValueError: Shape must be rank 4 but is rank 2 for 'conv_lst_m2d_1/while/Tile' (op: 'Tile') with input shapes: [?,64,64,1], [2].
Run Code Online (Sandbox Code Playgroud)
如何将 Masking 与 ConvLSTM2D 层一起使用?