is there a way to convert tensor to numpy or scalar python in Graph Mode?

why i need this? since i want to create a custom layer that need some complex operation,

using numpy is and native python easy for this, but the input param is tensor.

Tricky thing is i cannot convert tensor to numpy in graph mode.

It might be too late for this but I think if you use the @tf.function decoration in the beginning of the cell, everything in the cell should be converted in a graph when run. If you convert the tensor to numpy and then decorate with @tf.function then the whole downstream is converted into graph. Is it any helpful, thats all I can think of at this moment.