Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logical_slice_assign op如何支持 #66

Open
BBuf opened this issue May 24, 2022 · 0 comments
Open

logical_slice_assign op如何支持 #66

BBuf opened this issue May 24, 2022 · 0 comments

Comments

@BBuf
Copy link
Contributor

BBuf commented May 24, 2022

如何支持logical_slice_assign op?

例子:

import tempfile
import oneflow as flow
from oneflow_onnx.oneflow2onnx.util import convert_to_onnx_and_check

class logicalSliceAssign(flow.nn.Module):
    def __init__(self) -> None:
        super(logicalSliceAssign, self).__init__()
    
    def forward(self, x: flow.Tensor) -> flow.Tensor:
        x[:, 0 : 2] += x
        return x

logical_slice = logicalSliceAssign()
class logicalSliceOpGraph(flow.nn.Graph):
    def __init__(self):
        super().__init__()
        self.m = logical_slice

    def build(self, x):
        out = self.m(x)
        return out

def test_logical_slice():
    logical_slice_graph = logicalSliceOpGraph()
    logical_slice_graph._compile(flow.randn(1, 2, 1, 1))
    print(logical_slice_graph._ops_repr)

    with tempfile.TemporaryDirectory() as tmpdirname:
        flow.save(slice.state_dict(), tmpdirname)
        convert_to_onnx_and_check(logical_slice_graph, flow_weight_dir=tmpdirname, onnx_model_path="/tmp")

test_logical_slice()

来源 flowvision rexnet

@BBuf BBuf changed the title logical_slice_assign op无法处理 logical_slice_assign op如何支持 May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant