Beispiel #1
0
 def test_merge_mul(self):
     z1 = ZLayer.InputLayer(input_shape=(3, 5))
     z2 = ZLayer.InputLayer(input_shape=(3, 5))
     zlayer = ZLayer.Merge(layers=[z1, z2], mode="mul")
     k1 = KLayer.InputLayer(input_shape=(3, 5))
     k2 = KLayer.InputLayer(input_shape=(3, 5))
     klayer = KLayer.Merge(layers=[k1, k2], mode="mul")
     input_data = [np.random.random([2, 3, 5]), np.random.random([2, 3, 5])]
     self.compare_layer(klayer, zlayer, input_data)
Beispiel #2
0
 def test_merge_concat(self):
     z1 = ZLayer.InputLayer(input_shape=(2, 5, 11))
     z2 = ZLayer.InputLayer(input_shape=(2, 5, 8))
     zlayer = ZLayer.Merge(layers=[z1, z2], mode="concat")
     k1 = KLayer.InputLayer(input_shape=(2, 5, 11))
     k2 = KLayer.InputLayer(input_shape=(2, 5, 8))
     klayer = KLayer.Merge(layers=[k1, k2], mode="concat")
     input_data = [np.random.random([3, 2, 5, 11]), np.random.random([3, 2, 5, 8])]
     self.compare_layer(klayer, zlayer, input_data)
Beispiel #3
0
    def _to_tensor(self):
        axis = 0
        if "axis" in self.onnx_attr.keys():
            axis = int(self.onnx_attr['axis'])

        assert axis != 0, "Currently axis=0 is not supported"

        data = [i.zvalue for i in self.model_inputs]

        return zlayers.Merge(mode="concat", concat_axis=axis)(data)
Beispiel #4
0
 def _to_tensor(self):
     assert 'axis' in self.onnx_attr, "axis is a required attribute"
     axis = int(self.onnx_attr['axis'])
     data = [i.zvalue for i in self.model_inputs]
     return zlayers.Merge(mode="concat", concat_axis=axis)(data)