Description Usage Arguments Value Examples
View source: R/2-layers-learnable.R
This function calls k_conv2d
as a "lambda" layer.
1 | layer_kernel_conv2d(layer, kernel, name = NULL)
|
layer |
The incoming layer. |
kernel |
A layer that represents a kernel. |
name |
A string. The prefix label for all layers. |
The result of k_conv2d
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | library(keras)
library(caress)
set.seed(1)
index <- sample(1:nrow(iris))
x <- as.matrix(iris[index,1:4])
y <- to_categorical(as.numeric(iris[index,5])-1)
k_clear_session()
input <- from_input(x)
reshape <- input %>%
layer_reshape(c(4,1,1))
weight <- input %>%
layer_learnable_array(c(1, 1, 4)) %>%
layer_lambda(f = function(x) k_transpose(x))
target <- layer_kernel_conv2d(reshape, weight) %>%
layer_flatten() %>%
to_output(y)
m <- prepare(input, target)
build(m, x, y, batch_size = 4, epochs = 100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.