mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
🔖 Checkpoint: Edit /workspaces/claude-code-flow/fix_separable.py
This commit is contained in:
1 parent
7683763c89
commit
eb970da71c
3 files changed
+60
No files matched your search
@@ -0,0 +1 @@
|
||||
{"branch": "checkpoint/pre-edit-20250807-143346", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/cli/swe_bench_command.py", "timestamp": "2025-08-07T14:33:46Z", "type": "pre-edit", "original_branch": "swe-bench"}
|
||||
@@ -0,0 +1 @@
|
||||
{"tag": "checkpoint-20250807-143348", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/cli/swe_bench_command.py", "timestamp": "2025-08-07T14:33:48Z", "type": "post-edit", "branch": "swe-bench", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 108 +++++++++++++++++++++ .claude-flow/metrics/task-metrics.json | 6 +- .claude/checkpoints/1754577222.json | 1 + .claude/checkpoints/1754577224.json | 1 + .../src/swarm_benchmark/cli/swe_bench_command.py | 1 + 6 files changed, 115 insertions(+), 4 deletions(-) "}
|
||||
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Fixed version of the _cdot function from astropy/modeling/separable.py
|
||||
"""
|
||||
|
||||
def _cdot_fixed(left, right):
|
||||
"""
|
||||
Function corresponding to "|" operation.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
left, right : `astropy.modeling.Model` or ndarray
|
||||
If input is of an array, it is the output of `coord_matrix`.
|
||||
|
||||
Returns
|
||||
-------
|
||||
result : ndarray
|
||||
Result from this operation.
|
||||
"""
|
||||
from astropy.modeling.core import CompoundModel, Model
|
||||
import numpy as np
|
||||
|
||||
left, right = right, left
|
||||
|
||||
def _n_inputs_outputs(input, position):
|
||||
"""
|
||||
Return ``n_inputs``, ``n_outputs`` for a model or coord_matrix.
|
||||
"""
|
||||
if isinstance(input, Model):
|
||||
# FIX: Check if it's a CompoundModel and handle it differently
|
||||
if isinstance(input, CompoundModel):
|
||||
# For CompoundModels, use _separable to get the separability matrix
|
||||
coords = _separable(input)
|
||||
else:
|
||||
# For simple Models, use _coord_matrix as before
|
||||
coords = _coord_matrix(input, position, input.n_outputs)
|
||||
else:
|
||||
coords = input
|
||||
return coords
|
||||
|
||||
cleft = _n_inputs_outputs(left, "left")
|
||||
cright = _n_inputs_outputs(right, "right")
|
||||
|
||||
try:
|
||||
result = np.dot(cleft, cright)
|
||||
except ValueError:
|
||||
from astropy.modeling.core import ModelDefinitionError
|
||||
raise ModelDefinitionError(
|
||||
'Models cannot be combined with the "|" operator; '
|
||||
f"left coord_matrix is {cright}, right coord_matrix is {cleft}"
|
||||
)
|
||||
return result
|
||||
|
||||
print("Fixed _cdot function created")
|
||||
print("\nThe key change is in the _n_inputs_outputs nested function:")
|
||||
print("- Added check for CompoundModel using isinstance")
|
||||
print("- If it's a CompoundModel, call _separable(input) instead of _coord_matrix")
|
||||
print("- This ensures nested CompoundModels are processed correctly")
|
||||
Reference in new issue
Block a user