How to initialize local var?

I can successfully use mat = ti.Matrix([[0.0, 0.0], [1.0, 2.0]]) to create a matrix. However, when I tried to use mat = ti.var([[0.0, 0.0], [1.0, 2.0]]), it threw an error to me:

Traceback (most recent call last):
  File "D:/reflex/proj/optical_flow/flow_pred/lucas_kanade.py", line 111, in <module>
    a = ti.var([[0.0, 0.0], [1.0, 2.0]])
  File "C:\Users\49446\AppData\Local\conda\conda\envs\py36\lib\site-packages\taichi\lang\impl.py", line 158, in global_var
    x.ptr = taichi_lang_core.global_new(x.ptr, dt)
TypeError: global_new(): incompatible function arguments. The following argument types are supported:
    1. (arg0: taichi_core.Expr, arg1: taichi_core.DataType) -> taichi_core.Expr

Invoked with: <taichi_core.Expr object at 0x0000018294961340>, [[0.0, 0.0], [1.0, 2.0]]

Hi @143,

Thanks for the question.
ti.var is used to declare a scalar tensor in the global scope, outside Taichi kernels.
mat = ti.Matrix([[0.0, 0.0], [1.0, 2.0]]) is the correct syntax for creating a local matrix inside Taichi kernels. I would use the latter for initializing local matrices.