b4910f5fc768b1304099295a8d8d2d8d08474469,src/graph_transpiler/webdnn/graph/operators/space2depth.py,Space2Depth,__call__,#Space2Depth#Any#,33

Before Change



    def __call__(self, x: Variable):
        self.append_input("x", x)
        return self.exec()

    def exec(self):
        x = self.inputs["x"]
        assert x.order.check_same_axes(OrderNHWC), "Input variable of Depth2Space must have N, C, H, and W axes.: " \

After Change


        self.parameters["r"] = int(r)
        self.attributes.add(Tensorwise(Axis.N))

    def __call__(self, x: Variable):
        assert x.order.check_same_axes(OrderNHWC), "Input variable of Depth2Space must have N, C, H, and W axes.: " \
                                                   f"x.order.axes={x.order.axes}"
        assert x.shape_dict[Axis.H] % self.parameters["r"] == 0, \
            "Input variable H axis must be divisible by : " \
            f"r={self.parameters["r"]} " \
            f"x.shape_dict[Axis.H]={x.shape_dict[Axis.H]}"

        assert x.shape_dict[Axis.W] % self.parameters["r"] == 0, \
            "Input variable W axis must be divisible by : " \
            f"r={self.parameters["r"]} " \
            f"x.shape_dict[Axis.W]={x.shape_dict[Axis.H]}"

        N = x.shape_dict[Axis.N]
        C = x.shape_dict[Axis.C] * self.parameters["r"] * self.parameters["r"]
        H = x.shape_dict[Axis.H] // self.parameters["r"]
        W = x.shape_dict[Axis.W] // self.parameters["r"]
        y = Variable([N, H, W, C], OrderNHWC)
        y.change_order(x.order)  // output same order as input to preserve following reshape semantics

        self.append_input("x", x)
        self.append_output("y", y)
        return y,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 26

Instances


Project Name: mil-tokyo/webdnn
Commit Name: b4910f5fc768b1304099295a8d8d2d8d08474469
Time: 2018-01-25
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/graph/operators/space2depth.py
Class Name: Space2Depth
Method Name: __call__


Project Name: mil-tokyo/webdnn
Commit Name: b4910f5fc768b1304099295a8d8d2d8d08474469
Time: 2018-01-25
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/graph/operators/zero_padding_1d.py
Class Name: ZeroPadding1D
Method Name: __call__


Project Name: mil-tokyo/webdnn
Commit Name: b4910f5fc768b1304099295a8d8d2d8d08474469
Time: 2018-01-25
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/graph/operators/space2depth.py
Class Name: Space2Depth
Method Name: __call__


Project Name: mil-tokyo/webdnn
Commit Name: b4910f5fc768b1304099295a8d8d2d8d08474469
Time: 2018-01-25
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/graph/operators/zero_padding_2d.py
Class Name: ZeroPadding2D
Method Name: __call__