################################################################################ # Copyright(c)2020-2025 Shanghai Biren Technology Co., Ltd. All rights reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ################################################################################ import torch_br def convBB(input_tensor): o_layout = torch_br.supa._debug.get_tensor_info(input_tensor)[0]["layout"] o_layout = o_layout.lower() input_tensor_supa = torch_br._empty_ut_only( size=input_tensor.shape, dtype=input_tensor.dtype, is_numa=False, device=input_tensor.device, tensor_type=o_layout, sbp="BB", ) input_tensor_supa.copy_(input_tensor) return input_tensor_supa def convSB(input_tensor, axis: int): o_layout = torch_br.supa._debug.get_tensor_info(input_tensor)[0]["layout"] o_layout = o_layout.lower() input_tensor_supa = torch_br._empty_ut_only( size=input_tensor.shape, dtype=input_tensor.dtype, is_numa=False, device=input_tensor.device, tensor_type=o_layout, sbp="SB", axis=axis, ) input_tensor_supa.copy_(input_tensor) return input_tensor_supa