Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in data.frame(...): arguments imply differing number of rows: 2, 0 #5

Open
hermandr opened this issue Nov 14, 2018 · 5 comments
Labels
duplicate This issue or pull request already exists

Comments

@hermandr
Copy link

I tried to reproduce the example in the readme.
I encountered this error.

library(reprex)
library(deepviz)
library(tidyverse)
library(keras)

model <- keras_model_sequential() %>%
  layer_dense(10, input_shape = 4) %>%
  layer_dense(2, activation = "sigmoid")

model %>% plot_model()
#> Error in data.frame(id = 1:n, type = type, label = label, stringsAsFactors = FALSE): arguments imply differing number of rows: 2, 0

Created on 2018-11-14 by the reprex package (v0.2.1)

@andrie
Copy link
Owner

andrie commented Jan 21, 2019

I'm unable to reproduce this error. I get a different error, though:

 Error: Result 1 is not a length 1 atomic vector 

This is the same error as reported by #2

@andrie andrie added the duplicate This issue or pull request already exists label Jan 21, 2019
@andrie andrie changed the title Unable to reproduce example Error in data.frame(...): arguments imply differing number of rows: 2, 0 Jan 21, 2019
@roberthadow
Copy link

roberthadow commented Apr 7, 2019

Hello @andrie --
I saw the same results as @hermandr. The following code sits in a knitr script.

library(keras)
library(rlang)
devtools::install_github("andrie/deepviz")
library(deepviz)
library(magrittr)

model <- keras_model_sequential() %>% 
  layer_dense(units = 32, input_shape = c(784)) %>% 
  layer_activation('relu') %>% 
  layer_dense(units = 10) %>% 
  layer_activation('softmax')

model %>% plot_model()

My instance recognizes that deepviz is already properly installed and moves on. Then I get this error:

Error in data.frame(id = 1:n, type = type, label = label, stringsAsFactors = FALSE) : 
  arguments imply differing number of rows: 2, 0

Object model appears to be properly formed.

Model
__________________________________________________________________________________________________
Layer (type)                                Output Shape                           Param #        
==================================================================================================
dense_4 (Dense)                             (None, 32)                             25120          
__________________________________________________________________________________________________
activation_4 (Activation)                   (None, 32)                             0              
__________________________________________________________________________________________________
dense_5 (Dense)                             (None, 10)                             330            
__________________________________________________________________________________________________
activation_5 (Activation)                   (None, 10)                             0              
==================================================================================================
Total params: 25,450
Trainable params: 25,450
Non-trainable params: 0
__________________________________________________________________________________________________

@andrie
Copy link
Owner

andrie commented Apr 8, 2019

I tried your code example today, using a fresh install of keras and the underlying keras Python libraries. I could not reproduce.

My hunch is that there was an internal change in the way that keras represents model objects, and a recent version of deepviz accounts for this.

Please reinstall your keras python libraries, as well as the keras package and try again. If the error still persists, please provide your sessioninfo::session_info().

@roberthadow
Copy link

roberthadow commented Apr 8, 2019 via email

@roberthadow
Copy link

roberthadow commented Apr 8, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants