# Using numpy array with allocate\_const

**URL:** <https://discuss.tvm.apache.org/t/using-numpy-array-with-allocate-const/12491>\
**Category:** Questions\
**Created:** [April 5, 2022, 3:52pm UTC](https://discuss.tvm.apache.org/t/using-numpy-array-with-allocate-const/12491 "2022-04-05T15:52:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joshherr](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/joshherr/32/570_2.png) [@joshherr](https://discuss.tvm.apache.org/u/joshherr)\
**Post date:** [April 5, 2022, 3:52pm UTC](https://discuss.tvm.apache.org/t/using-numpy-array-with-allocate-const/12491/1 "2022-04-05T15:52:04Z")

</div>

Hello all,

I am trying to use the allocate\_const interface in order to create a compile-time constant tensor. However, when trying to instantiate a numpy array within the prim\_func, I get an error regarding not being able to use numpy inside of the function. Is there a way to allocate a constant tensor using a numpy array within a prim\_func?

Thanks

---

<div class="post-metadata">

**Author:** ![areusch](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/areusch/32/2118_2.png) [@areusch](https://discuss.tvm.apache.org/u/areusch)\
**Post date:** [April 11, 2022, 8:47pm UTC](https://discuss.tvm.apache.org/t/using-numpy-array-with-allocate-const/12491/2 "2022-04-11T20:47:30Z")

</div>

ccing @dmitriy-arm @manupa-arm @Mousius in case one of them knows this
