added tensor (3d matrix finalization