Revision 4f00eb848c71c48550f574784bef1199132a8a17 authored by ParvaH on 07 November 2021, 12:36:28 UTC, committed by GitHub on 07 November 2021, 12:36:28 UTC
* Adding check for all modes fixed case and if true then to just return initialization in CP decomposition - part of issue 292 * Adding check for all modes fixed case and if true then to just return the initialization Co-authored-by: Parvathy <Parvathy>
1 parent ddc7958
_factorized_tensor.py
from . import backend as T
from . import tenalg
from collections.abc import Mapping
from abc import ABCMeta
class FactorizedTensor(Mapping, metaclass=ABCMeta):
"""Base Class for Tensors in Factorized form
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def to_tensor(self):
return NotImplementedError
def to_unfolded(self, mode):
return NotImplementedError
def to_vec(self):
return NotImplementedError
def norm(self):
"""Norm l2 of the tensor"""
return T.norm(self.to_tensor())
def mode_dot(self, matrix_or_tensor, mode):
return tenalg.mode_dot(self.to_tensor(), matrix_or_tensor, mode)
Computing file changes ...