Comments (1)
test code is :
batch_size = 16
input_features = 32
state_size = 128
X = torch.randn(batch_size, input_features)
h = torch.randn(batch_size, state_size)
C = torch.randn(batch_size, state_size)
rnn = LLTM(input_features, state_size)
inputs = (X, (h, C))
traced = torch.jit.trace(rnn, inputs)
print(traced.graph)
torch.jit.save(traced, "lltm.pt")
graph(%self : torch.torch.nn.modules.module.Module,
%input : Float(16, 32),
%5 : (Float(16, 128), Float(16, 128))):
%39 : Tensor = prim::GetAttrname="bias"
%38 : Tensor = prim::GetAttrname="weights"
%old_h : Float(16, 128), %old_cell : Float(16, 128) = prim::TupleUnpack(%5)
%34 : (Tensor, Tensor) = ^LLTMFunction()(%input, %38, %39, %old_h, %old_cell) # /workspace/yanglinxia/CenterNet/torchscript/lltm-extension/LLTM.py:42:0
%35 : Float(16, 128), %36 : Float(16, 128) = prim::TupleUnpack(%34)
%37 : (Float(16, 128), Float(16, 128)) = prim::TupleConstruct(%35, %36)
return (%37)
Traceback (most recent call last):
File "script.py", line 22, in
torch.jit.save(traced, "lltm.pt")
File "/usr/local/anaconda3/lib/python3.6/site-packages/torch/jit/init.py", line 153, in save
m.save(f, _extra_files=_extra_files)
File "/usr/local/anaconda3/lib/python3.6/site-packages/torch/jit/init.py", line 1626, in save
return self._c.save(*args, **kwargs)
RuntimeError:
Could not export Python function call 'LLTMFunction'. Remove calls to Python functions before export. Did you forget add @script or @script_method annotation? If this is a nn.ModuleList, add it to constants:
/workspace/yanglinxia/CenterNet/torchscript/lltm-extension/LLTM.py(42): forward
/usr/local/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py(516): _slow_forward
/usr/local/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py(530): call
/usr/local/anaconda3/lib/python3.6/site-packages/torch/jit/init.py(1034): trace_module
/usr/local/anaconda3/lib/python3.6/site-packages/torch/jit/init.py(882): trace
script.py(19):
from extension-cpp.
Related Issues (20)
- JIT cpp extension fails to find cl.exe on windows? HOT 4
- www.facebook.com/rozi.khatun.961
- This repo can not compile using Pytorch 1.6.0 HOT 1
- This repo can not compile using Pytorch 1.6.0 HOT 1
- A question about backward propagation speed in cpp extension in tutorial
- Error when building cpp extension HOT 1
- AttributeError: module 'depthwise' has no attribute 'forward'
- cuda does not install HOT 17
- Cannot Unpack, Too Many Items
- How to debug in cuda-pytorch env?
- Writing a custom C++ extension with variants for both CPU and GPU? HOT 2
- Custom CUDA operator only work well on cuda:0 HOT 3
- How can I access data in cuda kernel like in pytorch?
- error LNK2001 undefined reference to `__cudaRegisterLinkedBinary
- Relation between at::Half and __half
- Deprecation warning
- Scikit-build-core / scikit-build support for binding
- `TORCH_LIBRARY` and `m.def` Not Working as Documented
- [feature request] Instruction on how to setup compile-env for Windows
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 extension-cpp.