Comments (9)
All CoreML tensors are 5-dimensional, but I'm not really sure what happens when the first two dimensions (batch size and sequence length) are not actually 1.
from coreml-custom-layers.
if the first two dimensions are actually 1x1, i don't know how to write a GPU version custom layer,
suppose input dimension is [1, 1, 3, 64, 64], how to write the GPU version custom layer as the texture is 2 dimensional ?
from coreml-custom-layers.
what is the input dimension is [1, 1, 128, 1024, 1024] where the third dimension is 128, not 3
from coreml-custom-layers.
The texture is actually a texture_array, which has multiple texture slices. Each slice has 4 channels.
from coreml-custom-layers.
so i can write code like this if input texture is [1, 1, 128, 1024, 1024] and output is [1, 1, 128, 1024, 1024]
`kernel void slice(
texture2d_array<half, access::read> inTexture [[texture(0)]],
texture2d_array<half, access::read> inTexture1 [[texture(1)]],
texture2d_array<half, access::read> inTexture2 [[texture(2)]],
texture2d_array<half, access::read> inTexture3 [[texture(3)]],
texture2d_array<half, access::read> inTexture4 [[texture(4)]],
texture2d_array<half, access::write> outTexture [[texture(5)]],
texture2d_array<half, access::write> outTexture1 [[texture(6)]],
texture2d_array<half, access::write> outTexture2 [[texture(7)]],
texture2d_array<half, access::write> outTexture3 [[texture(8)]],
texture2d_array<half, access::write> outTexture4 [[texture(9)]],
ushort3 gid [[thread_position_in_grid]])
{`
from coreml-custom-layers.
No, you just need the one texture2d_array<half, access::read> inTexture [[texture(0)]]
. Notice that its type is texture2d_array
, not texture2d
. When you read a pixel, you also specify the slice to read from: const auto pixel = inTexture.read(gid.xy, gid.z)
where gid.z
refers to the slice index.
from coreml-custom-layers.
Thanks for your help
from coreml-custom-layers.
if input is [1, 1, 128, 1024, 1024], so in texture2d_array<half, access::read> inTexture [[texture(0)]],
inTexture is of size [128, 1024, 1024], x is to 1024, y is to 1024, z is to 128 ?
from coreml-custom-layers.
Almost. Z would go from 0 to 32, since you need to divide the number of channels by 4 (because each texture slice contains 4 channels).
from coreml-custom-layers.
Related Issues (6)
- Lambda layer with multiple inputs? HOT 3
- keras to CoreML with custom loss function HOT 10
- Only channel and sequence concatenation are supported. HOT 15
- Running into Error keras functional is not supported HOT 1
- Why i enabled Metal API in encode function but my Coreml custom layer still run on CPU HOT 2
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 coreml-custom-layers.