Comments (3)
can you share your onnx model? it seems dimension error before tf.matmul
.
from onnx2tflite.
of course
this is the code of my model
class ResidualBlock(nn.Module):
def __init__(self, channels):
super(ResidualBlock, self).__init__()
self.conv1 = nn.Conv2d(channels, channels, kernel_size=3, stride=1, padding=1, bias=True)
self.in1 = nn.InstanceNorm2d(channels, affine=True)
self.relu = nn.ReLU(inplace=True)
self.conv2 = nn.Conv2d(channels, channels, kernel_size=3, stride=1, padding=1, bias=True)
self.in2 = nn.InstanceNorm2d(channels, affine=True)
def forward(self, x):
identity = x #(batch_size,channels,height,width)
out = self.conv1(x)
out = self.in1(out)
out = self.relu(out)
out = self.conv2(out)
out = self.in2(out)
out = out + identity
return out
class Generator(nn.Module):
def __init__(self):
super(Generator, self).__init__()
self.num_domains = 2
self.num_residual_blocks = 6
self.conv1 = nn.Conv2d(1, 64, kernel_size=7, stride=1, padding=3, bias=True)
self.in1 = nn.InstanceNorm2d(64, affine=True)
self.relu = nn.ReLU(inplace=True)
self.conv2 = nn.Conv2d(64, 128, kernel_size=4, stride=2, padding=1, bias=True)
self.in2 = nn.InstanceNorm2d(128, affine=True)
self.conv3 = nn.Conv2d(128, 256, kernel_size=4, stride=2, padding=1, bias=True)
self.in3 = nn.InstanceNorm2d(256, affine=True)
self.res_blocks = nn.ModuleList()
for _ in range(self.num_residual_blocks):
self.res_blocks.append(ResidualBlock(256))
self.deconv1 = nn.ConvTranspose2d(256, 128, kernel_size=4, stride=2, padding=1, bias=True)
self.in4 = nn.InstanceNorm2d(128, affine=True)
self.deconv2 = nn.ConvTranspose2d(128, 64, kernel_size=4, stride=2, padding=1, bias=True)
self.in5 = nn.InstanceNorm2d(64, affine=True)
self.conv4 = nn.Conv2d(64, 1, kernel_size=7, stride=1, padding=3, bias=True)
self.out_layers = nn.ModuleList()
for _ in range(2):
self.out_layers.append(nn.Linear(64, 64))
def forward(self, x):
out = self.conv1(x)
out = self.in1(out)
out = self.relu(out)
out = self.conv2(out)
out = self.in2(out)
out = self.relu(out)
out = self.conv3(out)
out = self.in3(out)
out = self.relu(out)
for block in self.res_blocks:
out = block(out)
out = self.deconv1(out)
out = self.in4(out)
out = self.relu(out)
out = self.deconv2(out)
out = self.in5(out)
out = self.relu(out)
out = self.conv4(out)
out = torch.tanh(out)
c_outs = []
for i in range(self.num_domains):
c_outs.append(self.out_layers[i](out))
return out, c_outs
from onnx2tflite.
Fixed
from onnx2tflite.
Related Issues (20)
- run torchvision_test, got KeyError: 'Shape not implemented yet' HOT 6
- 尝试把IMDN和RFDN的PyTorch模型转换成.tflite文件,使用AI benchmark APP简单部署在安卓手机测试速度,失败了!!! HOT 4
- KeyError: 'NonMaxSuppression not implemented yet' (YOLOv7 tiny onnx to tflite) HOT 2
- Add option to allow for dynamic resize HOT 4
- ValueError: Layer p_re_lu weight shape (1, 1, 32) is not compatible with provided weight shape (32, 1, 1). HOT 3
- Extract score and class_id from converted model HOT 6
- Add setup.py to be installed as a package HOT 2
- Opencv resize method use different axises, which leads to errors during int8 callibration
- onnx converting to tflite got an error, is there any solutions? HOT 3
- max error is too big during conversion HOT 2
- dimension error
- Convert fail Cannot reshape a tensor HOT 1
- yolov5s.onnx转换tflite出错 HOT 2
- Unable to perform 1dconv conversion? HOT 1
- The gpu cannot be used after model conversion HOT 1
- onnx转为tflite 为啥数据类型变成了uint8? HOT 1
- 模型转换缺少conv3d算子 HOT 3
- 报错
- 模型转换报错
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from onnx2tflite.