Comments (5)
I don't think that converting layers in bnn.torch to a cpu layer is going to work without some effort. If you look at the implementation of the layers in bnn.torch, they are implemented in Nvidia CUDA. You are going to have to write the corresponding cpu code yourself and use this function to swap it out:
def replace_module(module, check_fn, create_fn):
if not hasattr(module, 'modules'):
return
if module.modules is None:
return
for i in range(len(module.modules)):
m = module.modules[i]
if check_fn(m):
module.modules[i] = create_fn(m)
replace_module(m, check_fn, create_fn)
from binary-face-alignment.
Thank you for reply btomtom5.
I understand that, But since the base code for bnn.torch is written in Nvidia Cuda.
Can I atleast convert it to "cudnn."
So then I can use cudnn.torch to convert it to equivalent nn
from binary-face-alignment.
Hmmm. I don't think that works because the lua convert
function relies on the destination module nn
in this case to have the corresponding classes SpatialConvolution
and Binary
. nn does have a SpatialConvolution
defined but it needs to decode the weights before it can do the convolution. bnn.SpatialConvolution encodes the 32 weights of 0 and 1 as a single 32 bit integer.
Why do you want to run it in cpu only mode? I suggest renting out an ec2 instance with gpu support.
from binary-face-alignment.
Yeah.
So the only alternative would be writing a CPU equivalent of bnn.torch?
from binary-face-alignment.
That's correct, but you only need to write the forward pass of it.
- decode the weights from int32 to binary
- perform regular spatial convolution from the binary weights || perform bitwise operation which is much more performant.
After you do this, you should search through the loaded module and replace them with your newly written module using the code I shared above. You also have to make sure that the weights are migrated over though.
from binary-face-alignment.
Related Issues (12)
- Visualize the net structure! So complicated! HOT 6
- Training code
- The result of my training is very poor,why?
- Very large GPU memory consumption HOT 1
- where is the groundTruth in eval? HOT 1
- AFLWPIFA-val.tar can not download HOT 4
- Error when 'luarocks make' HOT 3
- How to convert to bnn.BinarySpatialConvolution from cudnn.SpatialConvolution.cu after training HOT 1
- Visualize the bounding box HOT 3
- How Can I preditct a new image? HOT 2
- How convert this model to pytorch? HOT 4
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 binary-face-alignment.