Closed muacq closed 1 year ago
Sorry for the late response.
field.native_call(model, grid)
is the right approach. For PyTorch, it will always use the order batch, channel, spatial.channel_dim
and spatial_dim
arguments to describe the output if its shape varies from the input.Thanks for your reply!
I have another question...Where can I see all solver's names supported by PhiFlow?
I just found some names in the demo code like:
'auto', 'CG', 'CG-adaptive', 'CG-native', 'direct', 'GMres', 'lGMres', 'biCG', 'CGS', 'QMR', 'GCrotMK'
Is there a Jacobian or Gauss-Seidel solver?
Only 'CG'
and 'CG-adaptive'
(and soon biCG
) are currently supported by all backends. If you use NumPy, you can also use the ones you mentioned but they won't work with TensorFlow or PyTorch.
Got it, Thanks for your reply!
Hi, I have encountered several problems while combining PhiFlow with Pytorch:
When combining PhiFlow with the self-defined PyTorch model, how to gracefully input PhiFlow grid data, and output grid data (with/without the same layout)?
I tried using
field.native_call(model, grid)
and it worked. But how can I make sure the native call processes the grid data in the right dimension I trained (e.g. 'vector, y, x' or 'vector, x, y')?What if the model's output doesn't have the same layout as the input (e.g. input 'vector, y, x' output 'y, x')?
Also, I tried converting the PhiFlow tensor to Pytorch tensor (e.g. CenterGrid
velocity.values.native("vector,y,x")
, then input the Pytorch tensor into the Pytorch model. I wondered if there is a graceful way to input and output grid data for the Pytorch model.Looking forward to your reply!