# Adding a 3d array (ndarray) as displacement for material output in blender python

To the material output node, for the displacement value I wish to add an nd array. Example given below to understand:

import numpy as np
nval=np.random.rand(1000,1000,3)
mat=bpy.data.materials["mymaterial"]
nodes=mat.node_tree.nodes
nodes['Material Output'].inputs['Displacement']=nval


This obviously throws error at the last step since nval is an ndarray. I know I can add image texure to the displacement map which is 3 dimensional RGB normal map. But I wish to add my own ndarray as displacement map to my material output. How can I do this using python script.