DeepFaceLive/xlib/avecl/_internal/info/TransposeInfo.py
2021-09-30 18:21:30 +04:00

38 lines
694 B
Python

from ..AShape import AShape
from ..AAxes import AAxes
class TransposeInfo:
"""
TransposeInfo
arguments
shape AShape
axes_order AAxes
errors during the construction:
ValueError
result
.o_shape AShape
.no_changes bool transpose changes nothing
"""
__slots__ = ['no_changes', 'o_shape']
def __init__(self, shape : AShape, axes_order : AAxes):
if shape.ndim != axes_order.ndim:
raise ValueError('axes must match the shape')
# Axes order changes nothing?
self.o_shape = shape[axes_order]
self.no_changes = axes_order == shape.axes_arange()