diff --git a/Billiards.html b/Billiards.html index 982a128d5..2c2109e22 100644 --- a/Billiards.html +++ b/Billiards.html @@ -15203,35 +15203,61 @@
+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[3], line 8 + 5 coords.append(vec(x=i * 2 * radius + 0.5, y=j * 2 * radius + 0.5 - i * radius * 0.7)) + 6 return Sphere(stack(coords, instance('balls')), radius=radius) +----> 8 plot(billiards_triangle()) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: + +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'Tensor']
+--------------------------------------------------------------------------- +ValueError Traceback (most recent call last) +Cell In[4], line 21 + 19 ball_v = PointCloud(balls, tensor([(1., 0), (0, 0)], shape(balls))) + 20 trj = iterate(physics_step, batch(t=20), ball_v, f_kwargs={'dt': .05}) +---> 21 plot(trj.geometry, animate='t') + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:242, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 175 def plot(*fields: Union[Field, Tensor, Geometry, list, tuple, dict], + 176 lib: Union[str, PlottingLibrary] = None, + 177 row_dims: DimFilter = None, + (...) + 191 plt_params: Dict = None, + 192 max_subfigures=20): + 193 """ + 194 Creates one or multiple figures and sub-figures and plots the given fields. + 195 + (...) + 240 In case of an animation, a displayable animation object will be returned instead of a `Tensor`. + 241 """ +--> 242 data = layout([layout_pytree_node(f) for f in fields], batch('args')) + 243 overlay = data.shape.only(overlay) + 244 animate = data.shape.only(animate).without(overlay) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_tensors.py:1734, in layout(objects, *shape) + 1730 return shape_stack(shape[0], *inner_shapes) + 1732 shape = recursive_determine_shape(objects, shape) +-> 1734 return Layout(objects, shape) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_tensors.py:961, in Layout.__init__(self, obj, stack_dim) + 959 super().__init__() + 960 self._obj = obj +--> 961 obj_shapes = Layout._recursive_get_shapes(obj, stack_dim) + 962 self._shape = shape_stack(stack_dim, *obj_shapes, stack_dim_first=True) + 963 self._stack_dim = stack_dim + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_tensors.py:975, in Layout._recursive_get_shapes(obj, s) + 973 return shape(obj, allow_unshaped=True), + 974 elif isinstance(obj, (tuple, list)): +--> 975 return sum([Layout._recursive_get_shapes(o, s.after_gather({s.names[0]: i})) for i, o in enumerate(obj)], ()) + 976 elif isinstance(obj, dict): + 977 return sum([Layout._recursive_get_shapes(v, s.after_gather({s.names[0]: i})) for i, (k, v) in enumerate(obj.items())], ()) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_tensors.py:973, in Layout._recursive_get_shapes(obj, s) + 970 @staticmethod + 971 def _recursive_get_shapes(obj, s: Shape) -> Tuple[Shape]: + 972 if not s: +--> 973 return shape(obj, allow_unshaped=True), + 974 elif isinstance(obj, (tuple, list)): + 975 return sum([Layout._recursive_get_shapes(o, s.after_gather({s.names[0]: i})) for i, o in enumerate(obj)], ()) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_shape.py:1533, in shape(obj, allow_unshaped) + 1531 return obj + 1532 elif isinstance(obj, BoundDim): +-> 1533 return shape(obj.obj)[obj.name] + 1534 elif hasattr(obj, '__shape__'): + 1535 return obj.__shape__() + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_shape.py:327, in Shape.__getitem__(self, selection) + 325 selection = [self.index(s.strip()) for s in selection.split(',')] + 326 else: +--> 327 selection = self.index(selection) + 328 return self[selection] + 329 elif isinstance(selection, Shape): + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_shape.py:185, in Shape.index(self, dim) + 183 elif isinstance(dim, str): + 184 if dim not in self.names: +--> 185 raise ValueError(f"Shape {self} has no dimension '{dim}'") + 186 return self.names.index(dim) + 187 elif isinstance(dim, Shape): + +ValueError: Shape (tᵇ=21, ballsⁱ=2, vectorᶜ=x,y) has no dimension 'geometry'+
+--------------------------------------------------------------------------- +ValueError Traceback (most recent call last) +Cell In[6], line 1 +----> 1 plot(loss_function(x0=vec(x=.1, y=.5), v0=vec(x=.3, y=0))[1].t[::16].geometry, animate='t') + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:242, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 175 def plot(*fields: Union[Field, Tensor, Geometry, list, tuple, dict], + 176 lib: Union[str, PlottingLibrary] = None, + 177 row_dims: DimFilter = None, + (...) + 191 plt_params: Dict = None, + 192 max_subfigures=20): + 193 """ + 194 Creates one or multiple figures and sub-figures and plots the given fields. + 195 + (...) + 240 In case of an animation, a displayable animation object will be returned instead of a `Tensor`. + 241 """ +--> 242 data = layout([layout_pytree_node(f) for f in fields], batch('args')) + 243 overlay = data.shape.only(overlay) + 244 animate = data.shape.only(animate).without(overlay) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_tensors.py:1734, in layout(objects, *shape) + 1730 return shape_stack(shape[0], *inner_shapes) + 1732 shape = recursive_determine_shape(objects, shape) +-> 1734 return Layout(objects, shape) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_tensors.py:961, in Layout.__init__(self, obj, stack_dim) + 959 super().__init__() + 960 self._obj = obj +--> 961 obj_shapes = Layout._recursive_get_shapes(obj, stack_dim) + 962 self._shape = shape_stack(stack_dim, *obj_shapes, stack_dim_first=True) + 963 self._stack_dim = stack_dim + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_tensors.py:975, in Layout._recursive_get_shapes(obj, s) + 973 return shape(obj, allow_unshaped=True), + 974 elif isinstance(obj, (tuple, list)): +--> 975 return sum([Layout._recursive_get_shapes(o, s.after_gather({s.names[0]: i})) for i, o in enumerate(obj)], ()) + 976 elif isinstance(obj, dict): + 977 return sum([Layout._recursive_get_shapes(v, s.after_gather({s.names[0]: i})) for i, (k, v) in enumerate(obj.items())], ()) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_tensors.py:973, in Layout._recursive_get_shapes(obj, s) + 970 @staticmethod + 971 def _recursive_get_shapes(obj, s: Shape) -> Tuple[Shape]: + 972 if not s: +--> 973 return shape(obj, allow_unshaped=True), + 974 elif isinstance(obj, (tuple, list)): + 975 return sum([Layout._recursive_get_shapes(o, s.after_gather({s.names[0]: i})) for i, o in enumerate(obj)], ()) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_shape.py:1533, in shape(obj, allow_unshaped) + 1531 return obj + 1532 elif isinstance(obj, BoundDim): +-> 1533 return shape(obj.obj)[obj.name] + 1534 elif hasattr(obj, '__shape__'): + 1535 return obj.__shape__() + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_shape.py:327, in Shape.__getitem__(self, selection) + 325 selection = [self.index(s.strip()) for s in selection.split(',')] + 326 else: +--> 327 selection = self.index(selection) + 328 return self[selection] + 329 elif isinstance(selection, Shape): + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_shape.py:185, in Shape.index(self, dim) + 183 elif isinstance(dim, str): + 184 if dim not in self.names: +--> 185 raise ValueError(f"Shape {self} has no dimension '{dim}'") + 186 return self.names.index(dim) + 187 elif isinstance(dim, Shape): + +ValueError: Shape (tᵇ=65, ballsⁱ=11, vectorᶜ=x,y) has no dimension 'geometry'+
+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[7], line 3 + 1 x0 = vec(x=.1, y=.5) + 2 v0 = lambda alpha: vec(x=0.3 * math.cos(alpha), y=0.3 * math.sin(alpha)) +----> 3 plot(CenteredGrid(lambda alpha: loss_function(x0, v0(alpha))[0], alpha=1000, bounds=Box(alpha=(-PI/4, PI/4)))) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: + +NoBackendFound: Could not resolve backend for native types ['bool', 'str', 'Tensor']
Iter=0 loss=0.6501343 x0=(x=0.100, y=0.500) ∇=(x=-0.654, y=1.529) v0=(x=0.300, y=0.000) ∇=(x=-0.889, y=1.734) -Iter=1 loss=0.6250768 x0=(x=0.107, y=0.485) ∇=(x=-0.656, y=-0.973) v0=(x=0.309, y=-0.017) ∇=(x=-0.980, y=-1.262) -Iter=2 loss=0.63563234 x0=(x=0.113, y=0.494) ∇=(x=-1.158, y=0.959) v0=(x=0.319, y=-0.005) ∇=(x=-1.381, y=0.953) -Iter=3 loss=0.6203982 x0=(x=0.125, y=0.485) ∇=(x=-1.096, y=-0.586) v0=(x=0.333, y=-0.014) ∇=(x=-1.306, y=-0.703) -Iter=4 loss=0.6252239 x0=(x=0.136, y=0.491) ∇=(x=-1.408, y=0.618) v0=(x=0.346, y=-0.007) ∇=(x=-1.462, y=0.491) -Final loss: 0.6168283 --
+--------------------------------------------------------------------------- +NotImplementedError Traceback (most recent call last) +Cell In[8], line 6 + 4 learning_rate = .01 + 5 for iter in range(5): +----> 6 (loss, trj), (dx0, dv0) = loss_grad(x0, v0) + 7 print(f"Iter={iter} loss={loss:.3f} x0={x0} ∇={dx0} v0={v0} ∇={dv0}") + 8 x0 -= learning_rate * dx0 + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_functional.py:636, in GradientFunction.__call__(self, *args, **kwargs) + 634 if key not in self.traces: + 635 self.traces[key] = self._trace_grad(key, wrt_natives) +--> 636 native_result = self.traces[key](*natives) + 637 output_key = match_output_signature(key, self.recorded_mappings, self) + 638 jac_shape = output_key.shapes[0].non_batch # ToDo prepend this to all wrt shapes + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/torch/_torch_backend.py:944, in TorchBackend.jacobian.<locals>.eval_grad(*args) + 941 @wraps(f) + 942 def eval_grad(*args): + 943 args, wrt_args = self._prepare_graph_inputs(args, wrt) +--> 944 loss, output = f(*args) + 945 if np.prod(self.staticshape(loss)) == 1: + 946 assert loss.requires_grad, f"Failed to compute gradient because function output does not depend on any input. Inputs: {args}" + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_functional.py:615, in GradientFunction._trace_grad.<locals>.f_native(*natives) + 612 assert len( + 613 loss_shape) == 0, f"Only scalar losses are allowed when returning a native tensor but {f_name(self.f)} returned {type(loss_native).__name__} of shape {loss_shape}. For higher-dimensional values, use Φ-ML tensors instead." + 614 nest, out_tensors = disassemble_tree(result, cache=True, attr_type=value_attributes) +--> 615 result_natives, result_shapes, specs = disassemble_tensors(out_tensors, expand=True) + 616 self.recorded_mappings[in_key] = SignatureKey(f_native, nest, result_shapes, specs, in_key.backend, in_key.tracing) + 617 return loss_native, result_natives + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_tensors.py:1845, in disassemble_tensors(tensors, expand) + 1834 """ + 1835 Args: + 1836 tensors: Tuple or list of Tensors. + (...) + 1842 One per tensor. + 1843 """ + 1844 tensors = [cached(t) if isinstance(t, TensorStack) or expand else t for t in tensors] +-> 1845 natives = sum([t._natives() for t in tensors], ()) + 1846 shapes = tuple([t.shape for t in tensors]) + 1847 specs = tuple([t._spec_dict() for t in tensors]) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_tensors.py:852, in Tensor._natives(self) + 851 def _natives(self) -> tuple: +--> 852 raise NotImplementedError(self.__class__) + +NotImplementedError: <class 'phiml.math._tensors.Layout'>
2024-10-06 12:21:05.030322: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered -2024-10-06 12:21:05.044694: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered -2024-10-06 12:21:05.049113: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered -2024-10-06 12:21:05.061011: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. +2024-10-07 11:30:35.674687: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered +2024-10-07 11:30:35.689190: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered +2024-10-07 11:30:35.693621: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered +2024-10-07 11:30:35.704864: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. -2024-10-06 12:21:06.060282: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT +2024-10-07 11:30:36.707855: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
(examplesᵇ=10, vectorᶜ=x,y) 0.419 ± 0.269 (6e-02...9e-01)+
(examplesᵇ=10, vectorᶜ=x,y) 0.550 ± 0.280 (1e-01...1e+00)@@ -15400,7 +15400,7 @@
(x=0.376, y=0.884)
+(x=0.580, y=0.412)
@@ -15449,18 +15449,18 @@ Tensor
-(examplesᵇ=10, vectorᶜ=x,y) 0.419 ± 0.269 (6e-02...9e-01) +(examplesᵇ=10, vectorᶜ=x,y) 0.550 ± 0.280 (1e-01...1e+00) (examplesᵇ=10, vectorᶜ=x,y) -[[0.4, 0.9], +[[0.6, 0.4], [0.1, 0.3], - [0.7, 0.9], - [0.3, 0.7], - [0.1, 0.2], - [0.6, 0.3], - [0.1, 0.6], - [0.3, 0.1], - [0.6, 0.7], - [0.4, 0.1]] + [0.2, 0.4], + [1.0, 0.9], + [0.3, 0.9], + [0.2, 0.7], + [0.8, 0.4], + [0.7, 0.2], + [0.8, 0.4], + [1.0, 0.7]]@@ -15503,35 +15503,60 @@Plot a
Tensor
-+@@ -15633,16 +15658,16 @@-@@ -15579,22 +15604,22 @@Out[9]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[9], line 2 + 1 data = math.random_uniform(spatial(x=8, y=6)) +----> 2 vis.plot(data) # or vis.show(data) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['Tensor', 'str', 'Tensor']-Convert a
Tensor
to NumPy -array([[0.23366916, 0.77822757, 0.51076126, 0.9744147 , 0.37954563, - 0.18154222], - [0.2315619 , 0.6648233 , 0.7119048 , 0.6393048 , 0.63858664, - 0.60814 ], - [0.31204498, 0.12089097, 0.43459094, 0.6246416 , 0.3803814 , - 0.05890048], - [0.42343682, 0.03447479, 0.78294075, 0.72517246, 0.77531445, - 0.7658634 ], - [0.25781244, 0.85141474, 0.41198778, 0.44912958, 0.6957595 , - 0.12772143], - [0.90811473, 0.9479639 , 0.84399194, 0.6691394 , 0.34335357, - 0.9858493 ], - [0.31881076, 0.24609572, 0.49153364, 0.17940438, 0.29851824, - 0.66224563], - [0.65576136, 0.51415294, 0.35803026, 0.20866394, 0.48418188, - 0.1074608 ]], dtype=float32)+array([[0.3329956 , 0.4011873 , 0.6239837 , 0.0376181 , 0.89401233, + 0.43821055], + [0.5358846 , 0.7988787 , 0.34376866, 0.8745558 , 0.7809825 , + 0.59379935], + [0.3717966 , 0.71178716, 0.49168497, 0.5758126 , 0.2874921 , + 0.58042383], + [0.17343128, 0.93945116, 0.27086568, 0.44141543, 0.15919876, + 0.0751192 ], + [0.6516449 , 0.938997 , 0.45098168, 0.45119005, 0.70229506, + 0.9216628 ], + [0.8307401 , 0.04403538, 0.28472513, 0.40246093, 0.7638735 , + 0.5899265 ], + [0.6238564 , 0.04896659, 0.8279844 , 0.21262503, 0.6256444 , + 0.7665008 ], + [0.00880033, 0.9075418 , 0.29580957, 0.31291986, 0.8558848 , + 0.02917475]], dtype=float32)Convert a
Tensor
to NumPy -array([[0.23366916, 0.77822757, 0.51076126, 0.9744147 , 0.37954563, - 0.18154222, 0.2315619 , 0.6648233 , 0.7119048 , 0.6393048 , - 0.63858664, 0.60814 , 0.31204498, 0.12089097, 0.43459094, - 0.6246416 , 0.3803814 , 0.05890048, 0.42343682, 0.03447479, - 0.78294075, 0.72517246, 0.77531445, 0.7658634 , 0.25781244, - 0.85141474, 0.41198778, 0.44912958, 0.6957595 , 0.12772143, - 0.90811473, 0.9479639 , 0.84399194, 0.6691394 , 0.34335357, - 0.9858493 , 0.31881076, 0.24609572, 0.49153364, 0.17940438, - 0.29851824, 0.66224563, 0.65576136, 0.51415294, 0.35803026, - 0.20866394, 0.48418188, 0.1074608 ]], dtype=float32)+array([[0.3329956 , 0.4011873 , 0.6239837 , 0.0376181 , 0.89401233, + 0.43821055, 0.5358846 , 0.7988787 , 0.34376866, 0.8745558 , + 0.7809825 , 0.59379935, 0.3717966 , 0.71178716, 0.49168497, + 0.5758126 , 0.2874921 , 0.58042383, 0.17343128, 0.93945116, + 0.27086568, 0.44141543, 0.15919876, 0.0751192 , 0.6516449 , + 0.938997 , 0.45098168, 0.45119005, 0.70229506, 0.9216628 , + 0.8307401 , 0.04403538, 0.28472513, 0.40246093, 0.7638735 , + 0.5899265 , 0.6238564 , 0.04896659, 0.8279844 , 0.21262503, + 0.6256444 , 0.7665008 , 0.00880033, 0.9075418 , 0.29580957, + 0.31291986, 0.8558848 , 0.02917475]], dtype=float32)@@ -15741,35 +15766,61 @@Construct a
CenteredGrid
-+--@@ -15825,35 +15876,61 @@Out[13]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[13], line 6 + 3 noise_grid = CenteredGrid(Noise(), extrapolation.PERIODIC, x=32, y=32) + 4 sin_curve = CenteredGrid(lambda x: math.sin(x), extrapolation.PERIODIC, x=100, bounds=Box(x=2 * PI)) +----> 6 vis.plot(zero_grid, y_grid, noise_grid, sin_curve, size=(12, 3)) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['Tensor', 'str', 'Tensor']-Construct a
StaggeredGrid
+--@@ -16121,35 +16198,61 @@Out[14]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[14], line 6 + 3 noise_grid = StaggeredGrid(Noise(), extrapolation.PERIODIC, x=32, y=32) + 4 sin_curve = StaggeredGrid(lambda x: math.sin(x), extrapolation.PERIODIC, x=100, bounds=Box(x=2 * PI)) +----> 6 vis.plot(zero_grid, y_grid, noise_grid, sin_curve, size=(12, 3)) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['Tensor', 'str', 'Tensor']-Sampling a Function -
+-@@ -16205,726 +16308,66 @@Out[19]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[19], line 5 + 2 return math.l2_loss(math.sin(x)) + 4 f_grid = CenteredGrid(f, x=100, y=100, bounds=Box(x=2*PI, y=2*PI)) +----> 5 vis.plot(f_grid) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['Tensor', 'str', 'Tensor']-Plot Optimization Trajectories -
/tmp/ipykernel_2295/1489350838.py:9: UserWarning: bounds argument is deprecated since 2.5 and will be ignored. +/tmp/ipykernel_2113/1489350838.py:9: UserWarning: bounds argument is deprecated since 2.5 and will be ignored. segments.append(PointCloud(start, end - start, bounds=Box(x=2*PI, y=2*PI)))+@@ -16982,8 +16425,8 @@-Out[20]:- - - -- -+ + + +++--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[20], line 11 + 9 segments.append(PointCloud(start, end - start, bounds=Box(x=2*PI, y=2*PI))) + 10 anim_segments = field.stack(segments, batch('time')) +---> 11 vis.plot(f_grid, anim_segments, overlay='args', animate='time', color='#FFFFFF', frame_time=500) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: + +NoBackendFound: Could not resolve backend for native types ['Tensor', 'str', 'Tensor']+Neural Network Training -
Initial loss: (batchᵇ=100) 0.204 ± 0.171 (3e-06...5e-01) -Final loss: (batchᵇ=100) 0.100 ± 0.084 (6e-06...3e-01) +Initial loss: (batchᵇ=100) 0.254 ± 0.272 (2e-04...9e-01) +Final loss: (batchᵇ=100) 0.081 ± 0.091 (5e-05...3e-01)diff --git a/FLIP.html b/FLIP.html index 102ace7e9..b94204388 100644 --- a/FLIP.html +++ b/FLIP.html @@ -15204,35 +15204,61 @@Fluid-Implicit-Particle (FLI
--- -Out[2]:- - - - -- -- -- - -@@ -15323,12 +15349,12 @@- ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[2], line 5 + 3 accessible_cells = CenteredGrid(~ground, 0, domain, x=64, y=64) + 4 particles = distribute_points(union(Box(x=(30, 55), y=(40, 62))), x=64, y=64, bounds=domain) * (0, 0) +----> 5 plot(accessible_cells, particles, overlay='args') + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: + +NoBackendFound: Could not resolve backend for native types ['ArrayImpl', 'str', 'ArrayImpl']Fluid-Implicit-Particle (FLI -
- - -@@ -15433,12 +15511,12 @@- ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[3], line 10 + 8 velocity0, pressure0 = fluid.make_incompressible(velocity) + 9 velocity1, pressure1 = operator_split_step(velocity0, None, dt=1.) +---> 10 plot({'initial vorticity': field.curl(velocity0), 'after step': field.curl(velocity1)}) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: + +NoBackendFound: Could not resolve backend for native types ['ArrayImpl', 'str', 'ArrayImpl']Operator Splitting +
Operator Splitting -
@@ -15494,3487 +15572,59 @@+@@ -19065,12 +15715,12 @@-Out[5]:- - - -- -+ + +++--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[5], line 1 +----> 1 plot(field.curl(velocity_trj), animate='time', same_scale=False) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: + +NoBackendFound: Could not resolve backend for native types ['ArrayImpl', 'str', 'ArrayImpl']+Higher-Order Simulations +
Higher-Order Simulations 336 v2_old = velocity + (dt / 2) * rhs1 337 v2, delta_p = make_incompressible(v2_old, solve=pressure_solve, order=pressure_order) -File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/field/_field.py:541, in Field.gradient(self, boundary, at, dims, stack_dim, order, implicit, scheme, upwind, gradient_extrapolation) - 539 """Alias for `phi.field.spatial_gradient`""" - 540 from ._field_math import spatial_gradient ---> 541 return spatial_gradient(self, boundary=boundary, at=at, dims=dims, stack_dim=stack_dim, order=order, implicit=implicit, scheme=scheme, upwind=upwind, gradient_extrapolation=gradient_extrapolation) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/field/_field.py:547, in Field.gradient(self, boundary, at, dims, stack_dim, order, implicit, scheme, upwind, gradient_extrapolation) + 545 """Alias for `phi.field.spatial_gradient`""" + 546 from ._field_math import spatial_gradient +--> 547 return spatial_gradient(self, boundary=boundary, at=at, dims=dims, stack_dim=stack_dim, order=order, implicit=implicit, scheme=scheme, upwind=upwind, gradient_extrapolation=gradient_extrapolation) File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/field/_field_math.py:244, in spatial_gradient(field, boundary, at, dims, stack_dim, order, implicit, implicitness, scheme, upwind, gradient_extrapolation) 240 assert stack_dim.name == 'vector' @@ -19201,7 +15851,7 @@
@@ -19145,10 +15795,10 @@Further Reading -{"state": {"15378410404b4f5aaced1a0a6e85bd44": {"model_name": "LayoutModel", "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "b4043446663f4f1f8cc57adb5872ae79": {"model_name": "ProgressStyleModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "bar_color": null, "description_width": ""}}, "b5e228e98d614b43ad2c4917495e5fa7": {"model_name": "FloatProgressModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_15378410404b4f5aaced1a0a6e85bd44", "max": 100.0, "min": 0.0, "orientation": "horizontal", "style": "IPY_MODEL_b4043446663f4f1f8cc57adb5872ae79", "tabbable": null, "tooltip": null, "value": 100.0}}, "5c5ebf38bf184222a837a17241f4a0e9": {"model_name": "LayoutModel", "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "731e491f86d14eefa93c524f6b9706e4": {"model_name": "HTMLStyleModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "background": null, "description_width": "", "font_size": null, "text_color": null}}, "fcdc7f5e84744fd0832d54c5eb992fef": {"model_name": "HTMLModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HTMLView", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_5c5ebf38bf184222a837a17241f4a0e9", "placeholder": "\u200b", "style": "IPY_MODEL_731e491f86d14eefa93c524f6b9706e4", "tabbable": null, "tooltip": null, "value": "100%"}}, "503df287c1234a10b53588368057f0bc": {"model_name": "LayoutModel", "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "83972638df3942b6a61b6d5e1bc25e76": {"model_name": "HTMLStyleModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "background": null, "description_width": "", "font_size": null, "text_color": null}}, "ffef1bf4d965447ea4c713c427896c87": {"model_name": "HTMLModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HTMLView", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_503df287c1234a10b53588368057f0bc", "placeholder": "\u200b", "style": "IPY_MODEL_83972638df3942b6a61b6d5e1bc25e76", "tabbable": null, "tooltip": null, "value": "\u2007100/100\u2007[00:27<00:00,\u2007\u20073.47it/s]"}}, "8831c6a87ff543f8a3c650bb7d27aba6": {"model_name": "LayoutModel", "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "dd590fc5daa441c2aea840779735807c": {"model_name": "HBoxModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HBoxView", "box_style": "", "children": ["IPY_MODEL_fcdc7f5e84744fd0832d54c5eb992fef", "IPY_MODEL_b5e228e98d614b43ad2c4917495e5fa7", "IPY_MODEL_ffef1bf4d965447ea4c713c427896c87"], "layout": "IPY_MODEL_8831c6a87ff543f8a3c650bb7d27aba6", "tabbable": null, "tooltip": null}}, "ed19af577b8746a3ae88c8543de73307": {"model_name": "LayoutModel", "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "68f13a8fb6c84ce7a2fdf0027dd2b3ef": {"model_name": "ProgressStyleModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "bar_color": null, "description_width": ""}}, "47eb8b12d7244095a2deb8ceae994639": {"model_name": "FloatProgressModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "ProgressView", "bar_style": "danger", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_ed19af577b8746a3ae88c8543de73307", "max": 200.0, "min": 0.0, "orientation": "horizontal", "style": "IPY_MODEL_68f13a8fb6c84ce7a2fdf0027dd2b3ef", "tabbable": null, "tooltip": null, "value": 0.0}}, "59fa227998ea49e5bdd6e848174c5eb5": {"model_name": "LayoutModel", "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "12e2d7bd3f4b46e2b2c9bdfef39dc8be": {"model_name": "HTMLStyleModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "background": null, "description_width": "", "font_size": null, "text_color": null}}, "1932bc98346c4ab596315ab17746e000": {"model_name": "HTMLModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HTMLView", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_59fa227998ea49e5bdd6e848174c5eb5", "placeholder": "\u200b", "style": "IPY_MODEL_12e2d7bd3f4b46e2b2c9bdfef39dc8be", "tabbable": null, "tooltip": null, "value": "\u2007\u20070%"}}, "67fbedb7605c4053abef0aa5241b1207": {"model_name": "LayoutModel", "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "194a027e385249998a291072a0011369": {"model_name": "HTMLStyleModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "background": null, "description_width": "", "font_size": null, "text_color": null}}, "01f0d9c6a69144f297fab37becef66e5": {"model_name": "HTMLModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HTMLView", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_67fbedb7605c4053abef0aa5241b1207", "placeholder": "\u200b", "style": "IPY_MODEL_194a027e385249998a291072a0011369", "tabbable": null, "tooltip": null, "value": "\u20070/200\u2007[00:05<?,\u2007?it/s]"}}, "90ba09e18f8143298d418fc6771a921a": {"model_name": "LayoutModel", "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "10be3f458d714671bc33e1cf49430fdc": {"model_name": "HBoxModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HBoxView", "box_style": "", "children": ["IPY_MODEL_1932bc98346c4ab596315ab17746e000", "IPY_MODEL_47eb8b12d7244095a2deb8ceae994639", "IPY_MODEL_01f0d9c6a69144f297fab37becef66e5"], "layout": "IPY_MODEL_90ba09e18f8143298d418fc6771a921a", "tabbable": null, "tooltip": null}}}, "version_major": 2, "version_minor": 0} +{"state": {"07e7e0f4a68b489fbb8176403e5189ae": {"model_name": "LayoutModel", "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "1842bb6c753d47f4828c8ca8db2c2985": {"model_name": "ProgressStyleModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "bar_color": null, "description_width": ""}}, "a2f82579f61b43a3a806f5acaa4ab825": {"model_name": "FloatProgressModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_07e7e0f4a68b489fbb8176403e5189ae", "max": 100.0, "min": 0.0, "orientation": "horizontal", "style": "IPY_MODEL_1842bb6c753d47f4828c8ca8db2c2985", "tabbable": null, "tooltip": null, "value": 100.0}}, "797986606e774afbbb394abfd4f48ace": {"model_name": "LayoutModel", "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "50616e5fd8674b37927142cd97d8c280": {"model_name": "HTMLStyleModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "background": null, "description_width": "", "font_size": null, "text_color": null}}, "262cad62fd8e45c7a6686a543d4df404": {"model_name": "HTMLModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HTMLView", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_797986606e774afbbb394abfd4f48ace", "placeholder": "\u200b", "style": "IPY_MODEL_50616e5fd8674b37927142cd97d8c280", "tabbable": null, "tooltip": null, "value": "100%"}}, "4656425b08e8449cac380db49eb02308": {"model_name": "LayoutModel", "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "101b830425b74b52939f9ee771ef7f89": {"model_name": "HTMLStyleModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "background": null, "description_width": "", "font_size": null, "text_color": null}}, "6c7015be30564e899796db2c178f61e6": {"model_name": "HTMLModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HTMLView", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_4656425b08e8449cac380db49eb02308", "placeholder": "\u200b", "style": "IPY_MODEL_101b830425b74b52939f9ee771ef7f89", "tabbable": null, "tooltip": null, "value": "\u2007100/100\u2007[00:27<00:00,\u2007\u20073.54it/s]"}}, "5553a1e6eb494982ae882c9096bf9a68": {"model_name": "LayoutModel", "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "01ac6404d40a4d51a38f5e7e95704f1b": {"model_name": "HBoxModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HBoxView", "box_style": "", "children": ["IPY_MODEL_262cad62fd8e45c7a6686a543d4df404", "IPY_MODEL_a2f82579f61b43a3a806f5acaa4ab825", "IPY_MODEL_6c7015be30564e899796db2c178f61e6"], "layout": "IPY_MODEL_5553a1e6eb494982ae882c9096bf9a68", "tabbable": null, "tooltip": null}}, "22d3059033aa410d8a36d4598572cfaf": {"model_name": "LayoutModel", "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "f3179e350d3540419192bd16ac272c0f": {"model_name": "ProgressStyleModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "bar_color": null, "description_width": ""}}, "cfe468bb3ea6413ca15c0aa42f7176da": {"model_name": "FloatProgressModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "ProgressView", "bar_style": "danger", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_22d3059033aa410d8a36d4598572cfaf", "max": 200.0, "min": 0.0, "orientation": "horizontal", "style": "IPY_MODEL_f3179e350d3540419192bd16ac272c0f", "tabbable": null, "tooltip": null, "value": 0.0}}, "0685e5c0597f4e9d99fdb53ed2f8404a": {"model_name": "LayoutModel", "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "eae86a5a3bb94696b0fa41ea8ca444d9": {"model_name": "HTMLStyleModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "background": null, "description_width": "", "font_size": null, "text_color": null}}, "21bfbbc63cdd4e3ebba493857ffbd154": {"model_name": "HTMLModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HTMLView", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_0685e5c0597f4e9d99fdb53ed2f8404a", "placeholder": "\u200b", "style": "IPY_MODEL_eae86a5a3bb94696b0fa41ea8ca444d9", "tabbable": null, "tooltip": null, "value": "\u2007\u20070%"}}, "a797fc1dc147441eaa9e37b8412e469f": {"model_name": "LayoutModel", "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "cacd090b8dfe4643a9f3369f866219bf": {"model_name": "HTMLStyleModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "background": null, "description_width": "", "font_size": null, "text_color": null}}, "664677258ec045c886a0425c86df939b": {"model_name": "HTMLModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HTMLView", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_a797fc1dc147441eaa9e37b8412e469f", "placeholder": "\u200b", "style": "IPY_MODEL_cacd090b8dfe4643a9f3369f866219bf", "tabbable": null, "tooltip": null, "value": "\u20070/200\u2007[00:05<?,\u2007?it/s]"}}, "d15ccbd61b5c40a7b191e71fc0c2766d": {"model_name": "LayoutModel", "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "61d11339d6634e8cb978899af7b2d5fb": {"model_name": "HBoxModel", "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HBoxView", "box_style": "", "children": ["IPY_MODEL_21bfbbc63cdd4e3ebba493857ffbd154", "IPY_MODEL_cfe468bb3ea6413ca15c0aa42f7176da", "IPY_MODEL_664677258ec045c886a0425c86df939b"], "layout": "IPY_MODEL_d15ccbd61b5c40a7b191e71fc0c2766d", "tabbable": null, "tooltip": null}}}, "version_major": 2, "version_minor": 0} diff --git a/Fluids_Tutorial.html b/Fluids_Tutorial.html index 59f741b0c..2d199cdbe 100644 --- a/Fluids_Tutorial.html +++ b/Fluids_Tutorial.html @@ -15366,35 +15366,61 @@
Running the Simulation -
+-@@ -15456,909 +15482,61 @@Out[6]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[6], line 6 + 3 velocity += buoyancy_force + 4 velocity, _ = fluid.make_incompressible(velocity) +----> 6 vis.plot(smoke) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']-Running the Simulation0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
+@@ -16621,36 +15799,61 @@-Out[7]:- - - -- -+ + + +++--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[7], line 10 + 8 trajectory.append(smoke) + 9 trajectory = field.stack(trajectory, batch('time')) +---> 10 vis.plot(trajectory, animate='time') + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: + +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']+Obtaining Gradients - -
Out[14]:- - - - -- --- - -diff --git a/Heightmaps.html b/Heightmaps.html index 0b7549af2..3a8ccfcee 100644 --- a/Heightmaps.html +++ b/Heightmaps.html @@ -15171,35 +15171,61 @@- ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[14], line 3 + 1 velocity_grad = sim_grad(initial_smoke, initial_velocity) +----> 3 vis.plot(velocity_grad) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: + +NoBackendFound: Could not resolve backend for native types ['Tensor', 'str', 'Tensor']Heightmaps¶
-+-@@ -15242,35 +15268,60 @@Out[2]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[2], line 4 + 2 bounds = Box(x=2, y=1) + 3 heightmap = geom.Heightmap(height, bounds, max_dist=.1) +----> 4 plot(heightmap) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']-Heightmaps¶
-+@@ -15869,46 +16036,46 @@-@@ -15316,35 +15367,60 @@Out[3]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[3], line 2 + 1 is_inside = CenteredGrid(lambda loc: heightmap.lies_inside(loc), x=100, y=100, bounds=Box(x=2, y=2)) +----> 2 plot(is_inside) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']-Heightmaps¶
-+@@ -15760,7 +15909,7 @@-@@ -15399,35 +15475,61 @@Out[4]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[4], line 2 + 1 distance = CenteredGrid(lambda loc: heightmap.approximate_signed_distance(loc), x=100, y=100, bounds=Box(x=2, y=2)) +----> 2 plot(distance, heightmap, overlay='args') +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']-Heightmaps¶
-@@ -15581,35 +15686,61 @@+--@@ -15493,51 +15595,54 @@Out[5]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[5], line 3 + 1 heightmap = geom.Heightmap(height, bounds, max_dist=1) + 2 distance = CenteredGrid(lambda loc: heightmap.approximate_signed_distance(loc), x=100, y=100, bounds=Box(x=2, y=2)) +----> 3 plot(distance, heightmap, overlay='args') +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']-Heightmaps¶
---------------------------------------------------------------------------- -AttributeError Traceback (most recent call last) +NoBackendFound Traceback (most recent call last) Cell In[6], line 3 1 points = Box(x=3, y=(-1, 1)).sample_uniform(instance(points=200)) 2 sgn_dist, delta, normal, _, face_index = heightmap.approximate_closest_surface(points) ----> 3 plot({'closest': [heightmap, PointCloud(points, .1 * math.vec_normalize(delta))], 4 'normal': [heightmap, PointCloud(points, .2 * normal)]}, overlay='list', color=[0, heightmap.lies_inside(points)*2+1]) -File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:399, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) - 397 for i, f in enumerate(fields): - 398 idx = indices[pos][i] ---> 399 plots.plot(f, figure, axes[pos], subplots[pos], min_val, max_val, show_color_bar, color[pos][i], alpha[idx], err[idx]) - 400 plots.finalize(figure) - 401 LAST_FIGURE[0] = figure - -File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis_base.py:384, in PlottingLibrary.plot(self, data, figure, subplot, space, *args, **kwargs) - 382 for recipe in self.recipes: - 383 if recipe.can_plot(data, space): ---> 384 recipe.plot(data, figure, subplot, space, *args, **kwargs) - 385 return - 386 raise NotImplementedError(f"No {self.name} recipe found for {data}. Recipes: {self.recipes}") +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_matplotlib/_matplotlib_plots.py:454, in VectorCloud2D.plot(self, data, figure, subplot, space, min_val, max_val, show_color_bar, color, alpha, err) - 452 u, v = reshaped_numpy(c_data.values.vector[dims], [vector, c_data.shape.without('vector')]) - 453 color_i = color[idx] ---> 454 if (color[idx] == 'cmap').all: - 455 col = _next_line_color(subplot, kind='collections') # ToDo - 456 elif color[idx].shape: +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -AttributeError: 'bool' object has no attribute 'all'-- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']-Vertical Heightmaps -
+-@@ -15662,7 +15793,7 @@Out[7]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[7], line 3 + 1 height = wrap([.1, .02, 0, 0, 1, .95, .8, .5, 0], spatial('y')) + 2 bounds = Box(x=1, y=2) +----> 3 plot(geom.Heightmap(height, bounds, max_dist=.1)) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']-2D Heightmaps
--------------------------------------------------------------------------- -AssertionError Traceback (most recent call last) +NoBackendFound Traceback (most recent call last) Cell In[8], line 4 2 height = CenteredGrid(lambda pos: math.exp(-math.vec_squared(pos-1) * 3), 0, bounds['x,y'], x=10, y=10).values 3 heightmap = geom.Heightmap(height, bounds, max_dist=.1) @@ -15675,28 +15806,46 @@+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: + +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']2D Heightmaps 59 plots = get_plots_by_figure(fig) 60 if isinstance(fig, Tensor): -File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:399, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) - 397 for i, f in enumerate(fields): - 398 idx = indices[pos][i] ---> 399 plots.plot(f, figure, axes[pos], subplots[pos], min_val, max_val, show_color_bar, color[pos][i], alpha[idx], err[idx]) - 400 plots.finalize(figure) - 401 LAST_FIGURE[0] = figure +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) -File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis_base.py:384, in PlottingLibrary.plot(self, data, figure, subplot, space, *args, **kwargs) - 382 for recipe in self.recipes: - 383 if recipe.can_plot(data, space): ---> 384 recipe.plot(data, figure, subplot, space, *args, **kwargs) - 385 return - 386 raise NotImplementedError(f"No {self.name} recipe found for {data}. Recipes: {self.recipes}") +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): -File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_dash/_plotly_plots.py:483, in Scatter3D.plot(self, data, figure, subplot, space, min_val, max_val, show_color_bar, color, alpha, err) - 481 color_i = plotly_color(color[idx].native()) - 482 if spatial(data.geometry): ---> 483 assert spatial(data.geometry).rank == 1 - 484 xyz = math.reshaped_numpy(data[idx].points.vector[dims], [vector, data.shape.non_channel.non_spatial, spatial]) - 485 xyz_padded = [[i.tolist() + [None] for i in c] for c in xyz] +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) -AssertionError:
2D Heightmaps
--------------------------------------------------------------------------- -AssertionError Traceback (most recent call last) +NoBackendFound Traceback (most recent call last) Cell In[9], line 3 1 points = bounds.sample_uniform(instance(points=200)) 2 sgn_dist, delta, normal, _, face_index = heightmap.approximate_closest_surface(points) @@ -15774,28 +15923,46 @@+NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']2D Heightmaps 59 plots = get_plots_by_figure(fig) 60 if isinstance(fig, Tensor): -File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:399, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) - 397 for i, f in enumerate(fields): - 398 idx = indices[pos][i] ---> 399 plots.plot(f, figure, axes[pos], subplots[pos], min_val, max_val, show_color_bar, color[pos][i], alpha[idx], err[idx]) - 400 plots.finalize(figure) - 401 LAST_FIGURE[0] = figure +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): -File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis_base.py:384, in PlottingLibrary.plot(self, data, figure, subplot, space, *args, **kwargs) - 382 for recipe in self.recipes: - 383 if recipe.can_plot(data, space): ---> 384 recipe.plot(data, figure, subplot, space, *args, **kwargs) - 385 return - 386 raise NotImplementedError(f"No {self.name} recipe found for {data}. Recipes: {self.recipes}") +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) -File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_dash/_plotly_plots.py:483, in Scatter3D.plot(self, data, figure, subplot, space, min_val, max_val, show_color_bar, color, alpha, err) - 481 color_i = plotly_color(color[idx].native()) - 482 if spatial(data.geometry): ---> 483 assert spatial(data.geometry).rank == 1 - 484 xyz = math.reshaped_numpy(data[idx].points.vector[dims], [vector, data.shape.non_channel.non_spatial, spatial]) - 485 xyz_padded = [[i.tolist() + [None] for i in c] for c in xyz] +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -AssertionError:
Combining Heightmaps 59 plots = get_plots_by_figure(fig) 60 if isinstance(fig, Tensor): -File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:334, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) - 332 ncols = uniform_bound(col_dims).volume - 333 assert nrows * ncols <= max_subfigures, f"Too many subfigures ({nrows * ncols}) for max_subfigures={max_subfigures}. If you want to plot this many subfigures, increase the limit." ---> 334 positioning, indices = layout_sub_figures(data, row_dims, col_dims, animate, overlay, 0, 0) - 335 # --- Process arguments --- - 336 plots = default_plots(positioning) if lib is None else get_plots(lib) - -File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:452, in layout_sub_figures(data, row_dims, col_dims, animate, overlay, offset_row, offset_col, positioning, indices, base_index) - 450 offset += shape(e).only(row_dims).volume - 451 elif dim0.only(col_dims): ---> 452 layout_sub_figures(e, row_dims, col_dims, animate, overlay, offset_row, offset_col + offset, positioning, indices, index) - 453 offset += shape(e).only(col_dims).volume - 454 else: - -File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:452, in layout_sub_figures(data, row_dims, col_dims, animate, overlay, offset_row, offset_col, positioning, indices, base_index) - 450 offset += shape(e).only(row_dims).volume - 451 elif dim0.only(col_dims): ---> 452 layout_sub_figures(e, row_dims, col_dims, animate, overlay, offset_row, offset_col + offset, positioning, indices, index) - 453 offset += shape(e).only(col_dims).volume - 454 else: - -File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:439, in layout_sub_figures(data, row_dims, col_dims, animate, overlay, offset_row, offset_col, positioning, indices, base_index) - 436 if dim0.only(overlay): - 437 for overlay_index in dim0.only(overlay).meshgrid(names=True): # overlay these fields - 438 # ToDo expand constants along rows/cols ---> 439 layout_sub_figures(data[overlay_index], row_dims, col_dims, animate, overlay, offset_row, offset_col, positioning, indices, {**base_index, **overlay_index}) - 440 elif dim0.only(animate): - 441 data = math.stack(data.native(), dim0) - -File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:458, in layout_sub_figures(data, row_dims, col_dims, animate, overlay, offset_row, offset_col, positioning, indices, base_index) - 456 else: # --- data must be a plottable object --- - 457 data = to_field(data) ---> 458 overlay = data.shape.only(overlay) - 459 animate = data.shape.only(animate).without(overlay) - 460 row_shape = data.shape.only(row_dims).without(animate).without(overlay) - -File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/field/_field.py:205, in Field.shape(self) - 203 return batch(self._geometry) & self.resolution & non_dual(self._values).without(self.resolution) & self._geometry.shape['vector'] - 204 set_shape = self._geometry.sets[self.sampled_at] ---> 205 return batch(self._geometry) & (channel(self._geometry) - 'vector') & set_shape & self._values +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:252, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 250 ncols = uniform_bound(col_dims).volume + 251 assert nrows * ncols <= max_subfigures, f"Too many subfigures ({nrows * ncols}) for max_subfigures={max_subfigures}. If you want to plot this many subfigures, increase the limit." +--> 252 positioning, indices = layout_sub_figures(data, row_dims, col_dims, animate, overlay, 0, 0) + 253 # --- Process arguments --- + 254 plots = default_plots(positioning) if lib is None else get_plots(lib) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:375, in layout_sub_figures(data, row_dims, col_dims, animate, overlay, offset_row, offset_col, positioning, indices, base_index) + 373 offset += shape(e).only(row_dims).volume + 374 elif dim0.only(col_dims): +--> 375 layout_sub_figures(e, row_dims, col_dims, animate, overlay, offset_row, offset_col + offset, positioning, indices, index) + 376 offset += shape(e).only(col_dims).volume + 377 else: + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:375, in layout_sub_figures(data, row_dims, col_dims, animate, overlay, offset_row, offset_col, positioning, indices, base_index) + 373 offset += shape(e).only(row_dims).volume + 374 elif dim0.only(col_dims): +--> 375 layout_sub_figures(e, row_dims, col_dims, animate, overlay, offset_row, offset_col + offset, positioning, indices, index) + 376 offset += shape(e).only(col_dims).volume + 377 else: + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:362, in layout_sub_figures(data, row_dims, col_dims, animate, overlay, offset_row, offset_col, positioning, indices, base_index) + 359 if dim0.only(overlay): + 360 for overlay_index in dim0.only(overlay).meshgrid(names=True): # overlay these fields + 361 # ToDo expand constants along rows/cols +--> 362 layout_sub_figures(data[overlay_index], row_dims, col_dims, animate, overlay, offset_row, offset_col, positioning, indices, {**base_index, **overlay_index}) + 363 return positioning, indices + 364 elif dim0.only(animate): + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:382, in layout_sub_figures(data, row_dims, col_dims, animate, overlay, offset_row, offset_col, positioning, indices, base_index) + 380 # --- data must be a plottable object --- + 381 data = to_field(data) +--> 382 overlay = data.shape.only(overlay) + 383 animate = data.shape.only(animate).without(overlay) + 384 row_shape = data.shape.only(row_dims).without(animate).without(overlay) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/field/_field.py:211, in Field.shape(self) + 209 return batch(self._geometry) & self.resolution & non_dual(self._values).without(self.resolution) & self._geometry.shape['vector'] + 210 set_shape = self._geometry.sets[self.sampled_at] +--> 211 return batch(self._geometry) & (channel(self._geometry) - 'vector') & set_shape & self._values File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_shape.py:735, in Shape.__and__(self, other) 733 if other is dual: diff --git a/IO_with_Scenes.html b/IO_with_Scenes.html index ff9e2fb30..0ef3842f0 100644 --- a/IO_with_Scenes.html +++ b/IO_with_Scenes.html @@ -15174,7 +15174,7 @@
Writing Data
-@@ -15284,35 +15284,61 @@/opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/field/_scene.py:150: RuntimeWarning: Failed to copy calling script to scene during Scene.create(): [Errno 2] No such file or directory: '/tmp/ipykernel_2796/2238997793.py' +/opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/field/_scene.py:150: RuntimeWarning: Failed to copy calling script to scene during Scene.create(): [Errno 2] No such file or directory: '/tmp/ipykernel_2608/2238997793.py' warnings.warn(f"Failed to copy calling script to scene during Scene.create(): {err}", RuntimeWarning)Writing Data
-+@@ -15462,35 +15488,59 @@-@@ -15419,7 +15445,7 @@Out[4]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[4], line 3 + 1 smoothness = math.random_uniform() + 2 data = CenteredGrid(Noise(smoothness=smoothness + 0.5), x=32, y=16) +----> 3 plot(data) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']-Reading Data
-{'smoothness': 0.3758765757083893}+{'smoothness': 0.7244935631752014}Reading Data
-+-@@ -15545,35 +15595,61 @@Out[8]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[8], line 1 +----> 1 plot(scene.read('noise_data', frame=0)) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']-Batched Data
-@@ -15796,35 +15844,59 @@+@@ -15765,7 +15813,7 @@-@@ -15620,35 +15696,60 @@Out[9]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[9], line 3 + 1 batched_smoothness = math.random_uniform(batch(batch=4)) + 2 batched_data = CenteredGrid(Noise(smoothness=batched_smoothness + 0.5), x=32, y=16) +----> 3 plot(batched_data, show_color_bar=False) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']-Batched Data
-@@ -15850,35 +15951,59 @@+@@ -15737,7 +15838,7 @@-@@ -15685,7 +15786,7 @@Out[11]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[11], line 2 + 1 scene = Scene.at('./data', 0) +----> 2 plot(scene.read('batched_noise_data'), show_color_bar=False) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']-Batched Data
-(0.291, 0.603, 0.591, 0.286) along batchᵇ float64+(0.429, 0.654, 0.730, 0.505) along batchᵇ float64Batched Data
-@@ -15819,7 +15920,7 @@/opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/field/_scene.py:150: RuntimeWarning: Failed to copy calling script to scene during Scene.create(): [Errno 2] No such file or directory: '/tmp/ipykernel_2796/3852168639.py' +/opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/field/_scene.py:150: RuntimeWarning: Failed to copy calling script to scene during Scene.create(): [Errno 2] No such file or directory: '/tmp/ipykernel_2608/3852168639.py' warnings.warn(f"Failed to copy calling script to scene during Scene.create(): {err}", RuntimeWarning)Batched Data
-0.2909450829029083+0.4290919005870819Batched Data
-@@ -15711,7 +15759,7 @@- -Out[16]:- - - - -- -- -- - -diff --git a/Math_Introduction.html b/Math_Introduction.html index 08dc04d25..94300359e 100644 --- a/Math_Introduction.html +++ b/Math_Introduction.html @@ -15279,35 +15279,59 @@- ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[16], line 1 +----> 1 plot(scene.read('batched_noise_data')) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: + +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']Introduction to Tensors in Φ
-@@ -15672,7 +15720,7 @@+@@ -15441,35 +15465,59 @@-@@ -15410,7 +15434,7 @@Out[4]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[4], line 1 +----> 1 plot(point) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']-Introduction to Tensors in Φ
-(x=-0.451, y=-0.276); (x=-2.358, y=-1.120); (x=-0.737, y=1.587) (pointsⁱ=3, vectorᶜ=x,y)+(x=0.419, y=-1.487); (x=1.657, y=-1.107); (x=0.159, y=-0.077) (pointsⁱ=3, vectorᶜ=x,y)Introduction to Tensors in Φ
-@@ -15621,7 +15669,7 @@+@@ -15570,7 +15618,7 @@-@@ -15519,7 +15567,7 @@Out[7]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[7], line 1 +----> 1 plot(points) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']-Introduction to Tensors in Φ
-(x=-0.451, y=-0.276)
+(x=0.419, y=-1.487)
Introduction to Tensors in Φ
-(-0.451, -2.358, -0.737) along pointsⁱ+(0.419, 1.657, 0.159) along pointsⁱIntroduction to Tensors in Φ
-(-0.451, -2.358, -0.737) along pointsⁱ+(0.419, 1.657, 0.159) along pointsⁱIntroduction to Tensors in Φ
--0.4508221
+0.41938224
Introduction to Tensors in Φ
--0.4508221
+0.41938224
Introduction to Tensors in Φ
-(xˢ=10) 0.472 ± 0.249 (9e-02...1e+00)+(xˢ=10) 0.605 ± 0.287 (1e-02...1e+00)Introduction to Tensors in Φ
-+-@@ -15865,35 +15937,59 @@Out[14]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[14], line 1 +----> 1 plot(grid) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['bool', 'str', 'int32']-Introduction to Tensors in Φ
-+-@@ -15935,35 +16031,59 @@Out[15]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[15], line 1 +----> 1 plot(math.random_uniform(spatial(x=10, y=8))) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']-Introduction to Tensors in Φ
-@@ -15316,35 +15331,61 @@+--@@ -16006,35 +16126,59 @@Out[16]:+ ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[16], line 1 +----> 1 plot(math.random_uniform(spatial(x=10)) * math.random_uniform(spatial(y=8))) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) -- -+File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result -- - +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: -- +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']-Introduction to Tensors in Φ
--- -Out[17]:- - - - -- -- -- - -diff --git a/SDF.html b/SDF.html index a984128d8..d6946d0e5 100644 --- a/SDF.html +++ b/SDF.html @@ -15239,40 +15239,55 @@- ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[17], line 1 +----> 1 plot(math.random_uniform(batch(examples=4), spatial(x=10, y=8)), show_color_bar=False) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: + +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']Custom SDF Construction -
/opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1675: RuntimeWarning: invalid value encountered in power - return base ** exp --- --Out[3]:- - - - -- -- -- - - - - - -- +-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[3], line 6 + 4 sdf_tensor = tensor(sdf_np, spatial('x,y')) + 5 sdf = geom.SDFGrid(sdf_tensor, bounds) +----> 6 plot(sdf_tensor, sdf) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: + +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']Sampling¶
-- -Out[4]:- - - - -- -- -- - -@@ -15426,35 +15467,61 @@- ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[4], line 3 + 1 to_grid = CenteredGrid(sdf, 0, bounds, x=40, y=40) + 2 soft = resample(sdf, to_grid, soft=True) +----> 3 plot(to_grid, soft) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: + +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']Querying the Surface -
- -Out[6]:- - - - -- -- -- - -diff --git a/data/sim_000000/batched_noise_data_000000.npz b/data/sim_000000/batched_noise_data_000000.npz index 4eee1dee1..8cd09ec6a 100644 Binary files a/data/sim_000000/batched_noise_data_000000.npz and b/data/sim_000000/batched_noise_data_000000.npz differ diff --git a/data/sim_000000/description.json b/data/sim_000000/description.json index 7ff58a11d..234793d43 100644 --- a/data/sim_000000/description.json +++ b/data/sim_000000/description.json @@ -10,10 +10,10 @@ null ], "data": [ - 0.2909450829029083, - 0.6031990647315979, - 0.5909240245819092, - 0.2855338454246521 + 0.4290919005870819, + 0.653761625289917, + 0.7298448085784912, + 0.5049718618392944 ] }, "__tensors__": [ diff --git a/data/sim_000000/noise_data_000000.npz b/data/sim_000000/noise_data_000000.npz index f15118f48..45b828d87 100644 Binary files a/data/sim_000000/noise_data_000000.npz and b/data/sim_000000/noise_data_000000.npz differ diff --git a/data/sim_000001/batched_noise_data_000000.npz b/data/sim_000001/batched_noise_data_000000.npz index 6e3883fa4..5b0728189 100644 Binary files a/data/sim_000001/batched_noise_data_000000.npz and b/data/sim_000001/batched_noise_data_000000.npz differ diff --git a/data/sim_000001/description.json b/data/sim_000001/description.json index 1a35fbf55..d2d1fa4d6 100644 --- a/data/sim_000001/description.json +++ b/data/sim_000001/description.json @@ -1,3 +1,3 @@ { - "smoothness": 0.2909450829029083 + "smoothness": 0.4290919005870819 } \ No newline at end of file diff --git a/data/sim_000002/batched_noise_data_000000.npz b/data/sim_000002/batched_noise_data_000000.npz index 71009581d..46c49349b 100644 Binary files a/data/sim_000002/batched_noise_data_000000.npz and b/data/sim_000002/batched_noise_data_000000.npz differ diff --git a/data/sim_000002/description.json b/data/sim_000002/description.json index 75e0a67eb..f2269caed 100644 --- a/data/sim_000002/description.json +++ b/data/sim_000002/description.json @@ -1,3 +1,3 @@ { - "smoothness": 0.6031990647315979 + "smoothness": 0.653761625289917 } \ No newline at end of file diff --git a/data/sim_000003/batched_noise_data_000000.npz b/data/sim_000003/batched_noise_data_000000.npz index 4a4ec6aa1..fa0b161a8 100644 Binary files a/data/sim_000003/batched_noise_data_000000.npz and b/data/sim_000003/batched_noise_data_000000.npz differ diff --git a/data/sim_000003/description.json b/data/sim_000003/description.json index 5a803bf23..76841d552 100644 --- a/data/sim_000003/description.json +++ b/data/sim_000003/description.json @@ -1,3 +1,3 @@ { - "smoothness": 0.5909240245819092 + "smoothness": 0.7298448085784912 } \ No newline at end of file diff --git a/data/sim_000004/batched_noise_data_000000.npz b/data/sim_000004/batched_noise_data_000000.npz index 93eb8aa8f..1f123ddc1 100644 Binary files a/data/sim_000004/batched_noise_data_000000.npz and b/data/sim_000004/batched_noise_data_000000.npz differ diff --git a/data/sim_000004/description.json b/data/sim_000004/description.json index a6c0cb0f5..bb874c2a6 100644 --- a/data/sim_000004/description.json +++ b/data/sim_000004/description.json @@ -1,3 +1,3 @@ { - "smoothness": 0.2855338454246521 + "smoothness": 0.5049718618392944 } \ No newline at end of file diff --git a/phi/field/index.html b/phi/field/index.html index fc907b922..34a7e8602 100644 --- a/phi/field/index.html +++ b/phi/field/index.html @@ -325,7 +325,7 @@- ++-+--------------------------------------------------------------------------- +NoBackendFound Traceback (most recent call last) +Cell In[6], line 3 + 1 loc = geom.UniformGrid(sdf.resolution.with_sizes(10), sdf.bounds).center + 2 sgn_dist, delta, normal, *_ = sdf.approximate_closest_surface(loc) +----> 3 plot(PointCloud(loc, delta)) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:266, in plot(lib, row_dims, col_dims, animate, overlay, title, size, same_scale, log_dims, show_color_bar, color, alpha, err, frame_time, repeat, plt_params, max_subfigures, *fields) + 264 log_dims = parse_dim_order(log_dims) or () + 265 color = layout_pytree_node(color, wrap_leaf=True) +--> 266 color = layout_color(positioning, indices, color) + 267 alpha = layout_pytree_node(alpha, wrap_leaf=True) + 268 alpha = tree_map(lambda x: 1 if x is None else x, alpha) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phi/vis/_vis.py:441, in layout_color(content, indices, color) + 439 channels = channel(f).without('vector') + 440 channel_colors = counter + math.range_tensor(channels) +--> 441 result_pos.append(math.where(cmap, wrap('cmap'), channel_colors)) + 442 counter += channels.volume * math.any(~cmap, shape) + 443 return result + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1151, in where(condition, value_true, value_false) + 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) +-> 1151 return broadcast_op(inner_where, [condition, value_true, value_false]) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1069, in broadcast_op(operation, tensors, iter_dims, no_return) + 1067 iter_dims = broadcast_dims(*tensors) if iter_dims is None else iter_dims + 1068 if len(iter_dims) == 0: +-> 1069 return operation(*tensors) + 1070 else: + 1071 if isinstance(iter_dims, Shape): + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/math/_ops.py:1148, in where.<locals>.inner_where(c, vt, vf) + 1146 return c._with_values(where(c_values, vt_values, vf_values)) + 1147 shape, (c, vt, vf) = broadcastable_native_tensors(c, vt, vf) +-> 1148 result = choose_backend(c, vt, vf).where(c, vt, vf) + 1149 return NativeTensor(result, shape) + +File /opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/phiml/backend/_backend.py:1746, in choose_backend(prefer_default, *values) + 1744 raise NoBackendFound(f"Not a native tensor {[type(v).__name__ for v in unknown_values]}") + 1745 else: +-> 1746 raise NoBackendFound(f"Could not resolve backend for native types {[type(v).__name__ for v in values]}") + 1747 # --- Native tensors? --- + 1748 for backend in backends: + +NoBackendFound: Could not resolve backend for native types ['bool_', 'str', 'int32']Args
-def divergence(field: phi.field._field.Field, order=2, implicit: phiml.math._optimize.Solve = None, upwind: phi.field._field.Field = None, implicitness: int = None) ‑>
CenteredGrid() at 0x7fe5ed35ec00> +def divergence(field: phi.field._field.Field, order=2, implicit: phiml.math._optimize.Solve = None, upwind: phi.field._field.Field = None, implicitness: int = None) ‑>CenteredGrid() at 0x7f4052552d40> Computes the divergence of a grid using finite differences.
@@ -1543,6 +1543,12 @@Args
""" return self._geometry + @property + def grid(self) -> UniformGrid: + """Cast `self.geometry` to a `phi.geom.UniformGrid`.""" + assert isinstance(self._geometry, UniformGrid), f"Geometry is not a UniformGrid but {type(self._geometry)}" + return self._geometry + @property def mesh(self) -> Mesh: """Cast `self.geometry` to a `phi.geom.Mesh`.""" @@ -2577,6 +2583,20 @@Returns
return self._geometry ++ prop grid : phi.geom._grid.UniformGrid
+ +Cast
self.geometry
to aUniformGrid
.+++Expand source code +
++@property +def grid(self) -> UniformGrid: + """Cast `self.geometry` to a `phi.geom.UniformGrid`.""" + assert isinstance(self._geometry, UniformGrid), f"Geometry is not a UniformGrid but {type(self._geometry)}" + return self._geometry
prop is_centered
@@ -3147,6 +3167,12 @@ +Args
""" return self._geometry + @property + def grid(self) -> UniformGrid: + """Cast `self.geometry` to a `phi.geom.UniformGrid`.""" + assert isinstance(self._geometry, UniformGrid), f"Geometry is not a UniformGrid but {type(self._geometry)}" + return self._geometry + @property def mesh(self) -> Mesh: """Cast `self.geometry` to a `phi.geom.Mesh`.""" @@ -4181,6 +4207,20 @@Returns
return self._geometry+ prop grid : phi.geom._grid.UniformGrid
+ +Cast
self.geometry
to aUniformGrid
.+++Expand source code +
++@property +def grid(self) -> UniformGrid: + """Cast `self.geometry` to a `phi.geom.UniformGrid`.""" + assert isinstance(self._geometry, UniformGrid), f"Geometry is not a UniformGrid but {type(self._geometry)}" + return self._geometry
prop is_centered
@@ -4750,6 +4790,12 @@ +Args
""" return self._geometry + @property + def grid(self) -> UniformGrid: + """Cast `self.geometry` to a `phi.geom.UniformGrid`.""" + assert isinstance(self._geometry, UniformGrid), f"Geometry is not a UniformGrid but {type(self._geometry)}" + return self._geometry + @property def mesh(self) -> Mesh: """Cast `self.geometry` to a `phi.geom.Mesh`.""" @@ -5784,6 +5830,20 @@Returns
return self._geometry+ prop grid : phi.geom._grid.UniformGrid
+ +Cast
self.geometry
to aUniformGrid
.+++Expand source code +
++@property +def grid(self) -> UniformGrid: + """Cast `self.geometry` to a `phi.geom.UniformGrid`.""" + assert isinstance(self._geometry, UniformGrid), f"Geometry is not a UniformGrid but {type(self._geometry)}" + return self._geometry
prop is_centered
@@ -7489,6 +7549,7 @@
Field
geometry
gradient
+ graph
grid
grid_scatter
is_centered
@@ -7551,6 +7612,7 @@ is_graph
Field
geometry
gradient
+ graph
grid
grid_scatter
is_centered
@@ -7613,6 +7675,7 @@ is_graph
Field
geometry
gradient
+ graph
grid
grid_scatter
is_centered
diff --git a/phi/geom/index.html b/phi/geom/index.html index 222aeb585..285a2d6f7 100644 --- a/phi/geom/index.html +++ b/phi/geom/index.html @@ -70,6 +70,12 @@ is_graph
Args
+ Tests that two objects have the same spatial rank. Objects can be of types:
int
,None
(no check),Geometry
,Shape
,Tensor
+ +def bounding_box(geometry: Union[phiml.math._tensors.Tensor, phi.geom._geom.Geometry]) +
+ + @@ -8256,6 +8262,7 @@ def build_mesh(bounds: phi.geom._box.Box = None, resolution=(), obstacles: Union[phi.geom._geom.Geometry, Dict[str, phi.geom._geom.Geometry]] = None, method='quad', cell_dim: phiml.math._shape.Shape = (cellsⁱ=None), face_format: str = 'csc', max_squish: Optional[float] = 0.5, **resolution_: Union[int, phiml.math._tensors.Tensor, tuple, list, Any]) ‑> phi.geom._mesh.Mesh
Returns
as_sdf
- +
assert_same_rank
bounding_box
build_mesh
concat
- diff --git a/phi/physics/fluid.html b/phi/physics/fluid.html index d108dd3bf..d035e0403 100644 --- a/phi/physics/fluid.html +++ b/phi/physics/fluid.html @@ -52,7 +52,7 @@
embed
Returns
Velocity of same type as
velocity
-def boundary_push(particles:
, obstacles: tuple, separation: float = 0.5) ‑> +def boundary_push(particles:, obstacles: tuple, separation: float = 0.5) ‑> Enforces boundary conditions by correcting possible errors of the advection step and shifting particles out of @@ -104,7 +104,7 @@
Returns
-def make_incompressible(velocity: phi.field._field.Field, obstacles: Obstacle = (), solve: phiml.math._optimize.Solve = auto with tolerance None (rel), None (abs), max_iterations=1000, active:
= None, order: int = 2, correct_skew=False, wide_stencil: bool = None) ‑> Tuple[phi.field._field.Field, phi.field._field.Field] +def make_incompressible(velocity: phi.field._field.Field, obstacles: Obstacle = (), solve: phiml.math._optimize.Solve = auto with tolerance None (rel), None (abs), max_iterations=1000, active:= None, order: int = 2, correct_skew=False, wide_stencil: bool = None) ‑> Tuple[phi.field._field.Field, phi.field._field.Field] Projects the given velocity field by solving for the pressure and subtracting its spatial_gradient.
diff --git a/phi/vis/index.html b/phi/vis/index.html index 7ddd0d06a..d5b06b55b 100644 --- a/phi/vis/index.html +++ b/phi/vis/index.html @@ -26,7 +26,7 @@Module
phi.vis
@@ -59,7 +59,7 @@ Visualization: plotting, interactive user interfaces.
-Use
+view()
to show fields or field variables in an interactive user interface.Use
view()
to show fields or field variables in an interactive user interface.Use
plot()
to plot fields using Matplotlib.See the user interface documentation at https://tum-pbs.github.io/PhiFlow/Visualization.html
Args
def control(value, range: tuple = None, description='', **kwargs)- Mark a variable as controllable by any GUI created via
+view()
.-Mark a variable as controllable by any GUI created via
view()
.Example:
@@ -218,6 +218,12 @@>>> dt = control(1.0, (0.1, 10), name="Time increment (dt)")
Args
+Args
See
plot()
.+ +def show_hist(data: phiml.math._tensors.Tensor, bins=(binsⁱ=20), weights=1, same_bins: Union[str, tuple, list, set, ForwardRef('Shape'), Callable] = None) +
+ + @@ -233,53 +239,6 @@ def smooth(curves: phiml.math._tensors.Tensor, n: int, ext: phiml.math.extrapolation.Extrapolation = <phiml.math.extrapolation._SymmetricGradientExtrapolation object>) ‑> phiml.math._tensors.Tensor
Args
Returns
Smoothed curves as
Tensor
- -def view(*fields: Union[str, phi.field._field.Field], play: bool = True, gui=None, name: str = None, description: str = None, scene: Union[bool, phi.field._scene.Scene] = False, keep_alive=True, select: Union[str, tuple, list] = '', framerate=None, namespace=None, log_performance=True, **config) ‑> phi.vis._viewer.Viewer -
- -Show
-fields
in a graphical user interface.-
fields
may contain instances ofField
or variable names of top-level variables (main module or Jupyter notebook). -During loops, e.g.view().range()
, the variable status is tracked and the GUI is updated.When called from a Python script, name and description may be specified in the module docstring (string before imports). -The first line is interpreted as the name, the rest as the subtitle. -If not specified, a generic name and description is chosen.
-Args
--
-- -
*fields
- (Optional) Contents to be displayed. Either variable names or values. -For field instances, all variables referencing the value will be shown. -If not provided, the user namespace is searched for Field variables.
-- -
play
- Whether to immediately start executing loops.
-- -
gui
- (Optional) Name of GUI as
-str
or GUI class. -Built-in GUIs can be selected via'dash'
,'console'
. -See https://tum-pbs.github.io/PhiFlow/Visualization.html- -
name
- (Optional) Name to display in GUI and use for the output directory if
-scene=True
. -Will be generated from the top-level script if not provided.- -
description
- (Optional) Description to be displayed in the GUI. -Will be generated from the top-level script if not provided.
-- -
scene
- Existing
-Scene
to write into orbool
. IfTrue
, creates a new Scene in~/phi/<name>
- -
keep_alive
- Whether the GUI should keep running even after the main thread finishes.
-- -
framerate
- Target frame rate in Hz. Play will not step faster than the framerate.
-None
for unlimited frame rate.- -
select
- Dimension names along which one item to show is selected. -Dimensions may be passed as
-tuple
ofstr
or as comma-separated names in a singlestr
. -For eachselect
dimension, an associated selection slider will be created.- -
log_performance
- Whether to measure and log the time each step takes. -If
-True
, will be logged asstep_time
tolog_step_time.txt
.- -
**config
- Additional GUI configuration arguments.
-Returns
-@@ -302,297 +261,6 @@ def write_image(path: str, figure=None, dpi=120.0, close=False, transparent=True)
Args
- Classes
--
- -
-class Viewer -
- -
--Shows variables from the user namespace. -To create a
-Viewer
, callview()
from the top-level Python script or from a notebook.Use
-Viewer.range()
to control the loop execution from the user interface.Also see the user interface documentation at https://tum-pbs.github.io/PhiFlow/Visualization.html
---Expand source code -
--class Viewer(VisModel): - """ - Shows variables from the user namespace. - To create a `Viewer`, call `phi.vis.view()` from the top-level Python script or from a notebook. - - Use `Viewer.range()` to control the loop execution from the user interface. - - Also see the user interface documentation at https://tum-pbs.github.io/PhiFlow/Visualization.html - """ - - def __init__(self, - namespace: UserNamespace, - fields: dict, - name: str, - description: str, - scene: Scene, - controls: tuple, - actions: dict, - log_performance: bool, - ): - VisModel.__init__(self, name, description, scene=scene) - self.initial_field_values = fields - self._controls = controls - self.namespace = namespace - self.log_performance = log_performance - self._rec = None - self._in_loop = False - self._log = SceneLog(self.scene) - self.log_file = self._log.log_file - self._elapsed = None - self.reset_step = 0 - self._actions = {} - custom_reset = False - self.reset_count = 0 - for action, function in actions.items(): - if action.name == 'reset': - self._actions[action] = partial(self.reset, custom_reset=function) - custom_reset = True - else: - self._actions[action] = function - if not custom_reset: - self._actions[Action('reset', Viewer.reset.__doc__)] = self.reset - - def log_scalars(self, reduce=math.mean, **values): - self._log.log_scalars(self.steps, reduce=reduce, **values) - - def info(self, message: str): # may be replaced by a different solution later on - """ - Update the status message. - The status message is written to the console and the log file. - Additionally, it may be displayed by the user interface. - - See `debug()`. - - Args: - message: Message to display - """ - message = str(message) - self.message = message - self._log.log(message) - - def __rrshift__(self, other): - self.info(other) - - @property - def field_names(self) -> tuple: - return tuple(self.initial_field_values.keys()) - - def get_field(self, name, dim_selection: dict) -> Field: - if name not in self.initial_field_values: - raise KeyError(name) - if self._rec: - value = self._rec[name] - else: - value = self.namespace.get_variable(name) - if callable(value): - value = value() - if isinstance(value, (Field, Tensor)): - value = value[dim_selection] - return value - - @property - def curve_names(self) -> tuple: - return self._log.scalar_curve_names - - def get_curve(self, name: str) -> tuple: - return self._log.get_scalar_curve(name) - - @property - def controls(self) -> Tuple[Control]: - return self._controls - - def get_control_value(self, name): - return self.namespace.get_variable(name) - - def set_control_value(self, name, value): - self.namespace.set_variable(name, value) - - @property - def actions(self) -> tuple: - return tuple(self._actions.keys()) - - def run_action(self, name): - for action, fun in self._actions.items(): - if action.name == name: - fun() - return - raise KeyError(name) - - def range(self, *args, warmup=0, **rec_dim): - """ - Similarly to `range()`, returns a generator that can be used in a `for` loop. - - >>> for step in ModuleViewer().range(100): - >>> print(f'Running step {step}') - - However, `Viewer.range()` enables controlling the flow via the user interface. - Each element returned by the generator waits for `progress` to be invoked once. - - Note that `step` is always equal to `Viewer.steps`. - - This method can be invoked multiple times. - However, do not call this method while one `range` is still active. - - Args: - *args: Either no arguments for infinite loop or single `int` argument `stop`. - Must be empty if `rec_dim` is used. - **rec_dim: Can be used instead of `*args` to record values along a new batch dimension of this name. - The recorded values can be accessed as `Viewer.rec.<name>` or `Viewer.rec['<name>']`. - warmup: Number of uncounted loop iterations to perform before `step()` is invoked for the first time. - - Yields: - Step count of `Viewer`. - """ - for _ in range(warmup): - yield self.steps - - self._in_loop = True - self._call(self.progress_available) - - if rec_dim: - assert len(rec_dim) == 1, f"Only one rec_dim allowed but got {rec_dim}" - assert not args, f"No positional arguments are allowed when a rec_dim is specified. {rec_dim}" - rec_dim_name = next(iter(rec_dim.keys())) - size = rec_dim[rec_dim_name] - assert isinstance(size, int) - self._rec = Record(rec_dim_name) - self._rec.append(self.initial_field_values, warn_missing=False) - args = [size] - self.growing_dims = [rec_dim_name] - - if len(args) == 0: - def count(): - i = 0 - while True: - yield i - i += 1 - - step_source = count() - else: - step_source = range(*args) - - try: - for step in step_source: - self.steps = step - self.reset_step - try: - self._pre_step() - t = time.perf_counter() - yield step - self.reset_step - self._elapsed = time.perf_counter() - t - self.steps = step - self.reset_step + 1 - if rec_dim: - self._rec.append({name: self.namespace.get_variable(name) for name in self.field_names}) - if self.log_performance: - self._log.log_scalars(self.steps, reduce=None, step_time=self._elapsed) - finally: - self._post_step() - finally: - self._in_loop = False - self._call(self.progress_unavailable) - - def _pre_step(self): - self._call(self.pre_step) - - def _post_step(self): - self._call(self.post_step) - - @property - def rec(self) -> 'Record': - """ - Read recorded fields as `viewer.rec.<name>`. - Accessing `rec` without having started a recording using `Viewer.range()` raises an `AssertionError`. - """ - assert self._rec, "Enable recording by calling range() with a dimension name, e.g. 'range(frames=10)'." - return self._rec - - def progress(self): - raise AssertionError("progress() not supported by synchronous Viewer.") - - @property - def can_progress(self) -> bool: - return self._in_loop - - def reset(self, custom_reset=None): - """ - Restores all viewed fields to the states they were in when the viewer was created. - Changes variable values in the user namespace. - """ - if custom_reset: - custom_reset() - for name, value in self.initial_field_values.items(): - self.namespace.set_variable(name, value) - self.reset_step += self.steps - self.steps = 0 - self.reset_count += 1
Ancestors
--
-- phi.vis._vis_base.VisModel
-Subclasses
--
-- phi.vis._viewer.AsyncViewer
-Instance variables
--
-- -
prop rec : Record
- -
--Read recorded fields as
viewer.rec.<name>
. -Accessingrec
without having started a recording usingViewer.range()
raises anAssertionError
.---Expand source code -
--@property -def rec(self) -> 'Record': - """ - Read recorded fields as `viewer.rec.<name>`. - Accessing `rec` without having started a recording using `Viewer.range()` raises an `AssertionError`. - """ - assert self._rec, "Enable recording by calling range() with a dimension name, e.g. 'range(frames=10)'." - return self._rec
Methods
--
-- -
-def range(self, *args, warmup=0, **rec_dim) -
- -
--Similarly to
-range()
, returns a generator that can be used in afor
loop.->>> for step in ModuleViewer().range(100): ->>> print(f'Running step {step}') -
However,
-Viewer.range()
enables controlling the flow via the user interface. -Each element returned by the generator waits forprogress
to be invoked once.Note that
-step
is always equal toViewer.steps
.This method can be invoked multiple times. -However, do not call this method while one
-range
is still active.Args
--
-- -
*args
- Either no arguments for infinite loop or single
-int
argumentstop
. -Must be empty ifrec_dim
is used.- -
**rec_dim
- Can be used instead of
-*args
to record values along a new batch dimension of this name. -The recorded values can be accessed asViewer.rec.<name>
orViewer.rec['<name>']
.- -
warmup
- Number of uncounted loop iterations to perform before
-step()
is invoked for the first time.Yields
-Step count of
Viewer
.