Skip to content

How to convert a drjit.llvm.ad.Int to a Python built-in int in the eval loop? #118

@Theo-Wu

Description

@Theo-Wu

In the eval function of BSDF, I want to use a drjit.llvm.ad.Int as an index for slicing a list. I tried to convert it into a python built-in int, for example,

a = mi.Point2i(1,2)
index = a.x[0]

or

a = mi.Point2i(1,2)
index = np.array(a.x).squeeze()

but I got the errors:

jitc_var_schedule(r1322138): placeholder variables are used to record computation symbolically
and cannot be scheduled for evaluation! This error message could appear for
the following reasons:

1. You are using DrJit's loop or virtual function call recording feature
   and tried to perform an operation that is not permitted in this restricted
   execution mode. Please see the documentation of recorded loops/virtual
   function calls to learn about these restrictions.

2. You are accessing a variable that was modified as part of a recorded
   loop and forgot to specify it as a loop variable. Please see the
   drjit::Loop documentation for details.

Can I get some suggestions about how to achieve that? Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions