Skip to content

Program crashes with constant tensorsΒ #442

@gbenfis

Description

@gbenfis

My program crashes when loading the model from the json file. Upon debugging, it crashes when looking for a keras_history in a node, and not finding any attribute with that name:

Assertion failed: it != m_data.m_value.object->end(), file C:\Users\e1081782\dependency\json\single_include\nlohmann\json.hpp, line 21449

This is most probably linked to the fact that my model normalizes the input tensor by subtracting a constant tensor (which has no history). Is there any workaround to make it execute?

    {
      "module": "keras.src.ops.numpy",
      "class_name": "Subtract",
      "config": { "name": "subtract_2" },
      "registered_name": "Subtract",
      "name": "subtract_2",
      "inbound_nodes": [
        {
          "args": [
            {
              "class_name": "__keras_tensor__",
              "config": {
                "shape": [ null, 11 ],
                "dtype": "float32",
                "keras_history": [ "input_1", 0, 0 ]
              }
            },
            {
              "class_name": "__tensor__",
              "config": {
                "value": [ [ 0.014991031028330326, -5.773593159119628e-08, 0.3049706220626831, 0.9997414946556091, 0.04997607693076134, 1.0001437664031982, 0.9999415874481201, 1.0001988410949707, 1.0000635385513306, 2.4990406036376953, 0.4999502897262573 ] ],
                "dtype": "float32"
              }
            }
          ],
          "kwargs": {}
        }
      ]
    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions