Setting matrix values with vector

So with Pandas I could do something like this( pseudo code)

keys = [0, 1]
arrays = [ [ 0, 0], [0, 0] ]
arrays[keys] = 9 
arrays ==  [ [ 9, 0] ,[ 0, 9] ]

How todo it with torch?

From https://github.com/torch/torch7/blob/master/doc/tensor.md#tensor-scatterdim-index-srcval

arrays.scatter_(0, keys, 9)