Previous question · 1513
Task Completion Actions
mediumDatabase
Next question · 1515
Validate IP Address
mediumAlgorithms
Random coding question

1514. LSTM gates forward

medium
GeneralGeneral
staff
Function contract
Inputs
x_t
np.ndarray
c_prev
np.ndarray
h_prev
np.ndarray
params
dict
Returns
value
tuple

Examples

Input
{
  "x_t": [
    1,
    -1
  ],
  "c_prev": [
    0.1,
    -0.2
  ],
  "h_prev": [
    0,
    0.5
  ],
  "params": {
    "Uc": [
      [
        0,
        0.1
      ],
      [
        0.2,
        0
      ]
    ],
    "Uf": [
      [
        0.1,
        0
      ],
      [
        0,
        0.2
      ]
    ],
    "Ui": [
      [
        0.05,
        0
      ],
      [
        0,
        0.1
      ]
    ],
    "Uo": [
      [
        0.2,
        0
      ],
      [
        0,
        0.2
      ]
    ],
    "Wc": [
      [
        0.4,
        0.1
      ],
      [
        -0.2,
        0.3
      ]
    ],
    "Wf": [
      [
        0.2,
        -0.1
      ],
      [
        0,
        0.3
      ]
    ],
    "Wi": [
      [
        -0.3,
        0.2
      ],
      [
        0.1,
        -0.2
      ]
    ],
    "Wo": [
      [
        0.1,
        0.2
      ],
      [
        0.3,
        -0.1
      ]
    ],
    "bc": [
      0,
      0
    ],
    "bf": [
      0,
      0
    ],
    "bi": [
      0,
      0
    ],
    "bo": [
      0,
      0
    ]
  }
}
Output
[
  [
    0.08663256108184865,
    -0.21549512016213457
  ],
  [
    0.184439699657245,
    -0.36111924850553045
  ]
]

Constraints

Hint 1
Hint 2
Hint 3
Roles
ML Engineer
AI Engineer
Data Scientist
Research Scientist
Companies
GeneralGeneral
Levels
staff
senior
entry
Tags
LSTM
forward-pass
matrix-vector-multiplication
activation-functions

Similar Questions

Linear Regressionmedium
ML Coding
Activation function relueasy
ML Coding
Text normalizationmedium
ML Coding
27 people are solving this problem
Loading editor for the selected language
Ln 1, Col 1
Program Output
DATAINTERVIEW
Interactive coding terminal
Python / NumPy environment ready.
Type a command below or run code from the editor.
run scriptExecute the current editor contents
submitGrade the current editor contents against all solution test cases
python ("print hello world")Run an isolated Python command
helpShow all available commands