Closed oguzziya closed 4 years ago
Hi oguzziya, I'll look into it. Could you attach the full script you're running?
I attach the files. Apparently, github does not support .py format, therefore I send them with .txt postfix manual_torch.txt utils.txt
Or if it is easier, here is link to my fork and corresponding branch: oguzziya/PhiFlow
Thanks. I have pushed a fix to the 1.5 branch. You will still get TypeErrors from combining Numpy arrays with PyTorch tensors. I've added additional torch_from_numpy calls to fix it. This should work: manual_torch.py.txt
Currently I am trying to adapt
manual_numpy_or_tf.py
demo to PyTorch, with some additional changes. However, I could not make it work with PyTorch at all. The simplified steps are:1- Create
Fluid
object, which will consist ofnumpy.ndarray
by default.2- Copy this object to PyTorch
3- (After some unrelated operations) Sample velocity at points of density
Problems occur at this stage. First of all, type of
x_rho
is stillnumpy.ndarray
, nottorch.Tensor
. Secondly,sample_at
operation throws the error:I would be glad to hear any opinions, possible fixes, or steps that I overlook.
Thank you