{"record":{"id":"27aec9727dd70ebd","repo":"rohitg00/ai-engineering-from-scratch","slug":"partial-indexing-not-supported-in-this-basic-imple","errorCode":null,"errorMessage":"Partial indexing not supported in this basic implementation","messagePattern":"Partial indexing not supported in this basic implementation","errorType":"exception","errorClass":"IndexError","httpStatus":null,"severity":"error","filePath":"phases/01-math-foundations/12-tensor-operations/code/tensors.py","lineNumber":91,"sourceCode":"        if len(indices) != len(self._shape):\n            raise IndexError(\n                f\"Expected {len(self._shape)} indices, got {len(indices)}\"\n            )\n        idx = 0\n        for i, (ind, stride) in enumerate(zip(indices, self._strides)):\n            if ind < 0 or ind >= self._shape[i]:\n                raise IndexError(\n                    f\"Index {ind} out of range for axis {i} with size {self._shape[i]}\"\n                )\n            idx += ind * stride\n        return idx\n\n    def __getitem__(self, indices):\n        if not isinstance(indices, tuple):\n            indices = (indices,)\n        if len(indices) == len(self._shape):\n            return self._data[self._flat_index(indices)]\n        raise IndexError(\"Partial indexing not supported in this basic implementation\")\n\n    def __setitem__(self, indices, value):\n        if not isinstance(indices, tuple):\n            indices = (indices,)\n        self._data[self._flat_index(indices)] = value\n\n    def reshape(self, new_shape):\n        new_shape = list(new_shape)\n        neg_idx = -1\n        known_product = 1\n        for i, s in enumerate(new_shape):\n            if s == -1:\n                if neg_idx != -1:\n                    raise ValueError(\"Only one dimension can be -1\")\n                neg_idx = i\n            else:\n                known_product *= s\n","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/01-math-foundations/12-tensor-operations/code/tensors.py#L73-L109","documentation":"Error \"Partial indexing not supported in this basic implementation\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/01-math-foundations/12-tensor-operations/code/tensors.py:91 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}