20211022: run tests and fix them if possible
Set Python environment from RStudio project settings
TODO.
basic torch operations
conversion from NumPy
to torch
and viceversalogistic regression
linear regression
install_pytorch()
functionmethods
from Imports
in DESCRIPTION.[]()
or local link. Must use full URL if want to link to cran-comments.md
.Solaris: pandoc (>= 2.0), qpdf ( >= 7.0);
. Getting now two notes and a warrning.Solaris: pkgutil -y -i qpdf, pkgutil -y -i pandoc"
to SysReqs.skip_on_cran()
in test_r_torch_share_objects.R, test_types.R, and test-install_rtorch_dryrun.R. Causing errors in Fedora. It doesn't want to install numpy
but now errors went away in Fedora and Solaris because is nos tested on numpy
.numpy
at the top of test fileqpdf, pandoc (>= 2.7.2) on Solaris"
.numpy ( >= 1.14.0)
for Fedora.solaris-x86-patched
platform to rhub.SystemRequirements: "conda (python=3.6 pytorch torchvision cpuonly matplotlib pandas -c pytorch), Python (>=3.6), pytorch (>=1.6), torchvision, numpy"
. It makes no difference in Fedora.fedora-clang-devel
in rhub. Still throwing error ModuleNotFoundNo module named 'numpy'
. failed. It seems tha Fedora cannot install numpy
as painless as in Debian or Ubuntu.test_types.R
. Put quotes at the beginning of the function parentheses in Python code.rhub
to debug.sign
, abs
, sqrt
, floor
, ceil
, round
, sin
, cos
, tan
, asin
, acos
, atan
in generics.R
. Documented.tests/testthat/rhub-tests.R
that sends rTorch for testing on three different platforms. Use it as well in addition to Travis and Appveyor. Closer to CRAN tests.data.table
and R6
from Imports
. Not used yet.torch_config
does not update output after issuing a install_pytorch()
command; they return the previous installed PyTorch info. The purpose of these test was initially see if the installation performed as
initially planned. It works outside unit tests. But we cannot enable this test for CRAN because it will take longer time and may not work due to the PyTorch installation process. The major problem I found with these tests is that the torch_config
objects do not update after issuing a new install_pytorch
.reticulate.R
from rTorch code. Some functions were previously customized to accept channel
. Now the reticulate
package accepts channel
as a function parameter.SystemRequirements
because CRAN is not passing.skip_if_no_python()
so CRAN doesn't throw error in unit test test-install_rtorch_dryrun.R
utils.R
by helper_utils.R
. We also have utils.R
under the R folder.test-install_rtorch_dryrun.R
in two files. The second one test-install_rtorch_parse_version.R
will only perform the parsing of what is being sent to install_pytorch()
.skip_if_no_python()
in case there is no way Python is installed at the testing point.rhub
for testing before releasing to CRAN.skip_if_no_torch()
in tests in cases where PyTorch cannot be installed in CRAN.skip_if_no_python()
.\dontest
to \dontrun
in examples.0.4.0-fix_examples_problem_in_cran
.tests/testthat/utils.R
to include skip_on_cran()
PyTorch
versions 1.4, 1.5, 1.6.Python
3.6, 3.7 and 3.8. A testing matrix was implemented in Travis
and Appveyor
to test version combinations of Python, PyTorch and R. The R versions tested were R-3.4.3
, R-3.5.3
, R-3.6.3
, and R-4.0.2
.travis.yml
by bringing - PYTHON_V="3.7" PYTORCH_V="1.6"
near env: metrix
. Maybe some space or alignment was preventing ennvronment variables being passed to Travis containers.is_rtorch_env_name()
and env_name
object to torch_config()
to live unit test install_pytorch()
install_pytorch()
to vignettepython_version
to function conda_install()
Roxygen: list(markdown = TRUE)
PYTORCH_VERSION
and PYTHON_VERSION
in Travis.and
, or
and not
to be boolean or uint8 as their inputs.equal
and not equal
.uint8
types. Currently, AND ("!") and OR ("|") return booleans while NOT
and others don't; they return uint8
. We should fix this lack of consistency.uint8
. Newer PyTorch versions make the conversion of the comparison and return boolean values. In 1.1 they return uint8
.torch$eq()
and torch$ne()
to validate boolean inputs.eq()
and ne()
in PyTorch 1.1. They return tensor(True, dtype=torch.bool)
or tensor(False, dtype=torch.bool)
.generics.R
and properties.R
uint8
types as original PyTorch functions in generics.R
.torch$all
, torch$any
and some generic logicals in test-tensor_comparison.R
.!.torch.Tensor
to return boolean if input is boolean, otherwise return opriginal type. Fix tests in test_generics.R
and test_numpy_logical.R
.R-4.0.2
and Python 3.7
,install_pytorch(conda_python_version = "3.8", version = "1.2")
. Tests failed. But not because of PyTorch but conflict during the conda installation.install_pytorch(conda_python_version = "3.8", version = "1.4")
with tests passed.numpy
version to printout of rtorch_config()
.Python 3.8
because they fail with all PyTorch versions.PYTHON_VERSION
to conda in build_script of appveyor. Twelve (12) passed.Python 3.6
and Python 3.7
, and 3.8
for only PyTorch 1.6
, a total of 36 tests. All passed.Python 3.6
and Python 3.7
, a total of 36 tests. All passed.develop
branch with Travis and Appveyor. All tests passed.0.0.3.9010-fix-appveyor
-cpu
from pytorch
and torchvision
packages from appveyor.yml
. still failing because of python version is 3.6.1.appveyor.yml
. Passed.f0nzie/r-appveyor
requires some changes.appveyor-tool.ps1
in r-appveyor
repo. changes related to Rtools4.pytorch=1.1.0
. Will change to pytorch=1.4
.python=3.7
and pytorch=1.4
. All R versions passed.DESCRIPTION
. remove ctb. will credit them in README.python=3.7
and pytorch=1.6
. All R versions passed.pytorch=1.4
and R-4.0.2. Passed.pytorch=1.2, 1.4, 1.6
and R-4.0.2. Passed.R
: 4.0.2 and 3.6.3 over pytorch
, 1.1, 1.2, 1.4, and 1.6. using appveyor variable R_VERSION
.python=3.8
and pytorch=1.1
failing for all R
versions. Rest of tests passed.R
: 4.0.2
, 3.6.3
and 3.5.3
over pytorch
, 1.1, 1.2, 1.4, and 1.6. using appveyor variable R_VERSION
.0.0.3.9008-implement-todo-items
test_numpy_logical.R
to check sample tensorstest_info.R
add test to check the version three componentsmake_copy
function0.0.3.9007-fix-auto-load-torch
package.R
on_load()
make_copy()
to consider when an object have multiple classes. Use any
for the logical selectioninstall_pytorch()
and parse_torch_version()
.install_pytorch()
and parse_torch_version()
install_pytorch()
and parse_torch_version()
dry_run
option to install_pytorch()
to use output values in unit teststest-install_commands.R
tensor_dim_
to tensor_ndim
make_copy()
moved from unit test utilities.torch$index
(not applicable).message()
instead of print()
examples
.RuntimeError: Expected object of scalar type Byte but got scalar type Long
in [.torch.Tensor
at generics functions.(all(y[all_dims(), 1] == y[,,,,1]) == torch$tensor(1L))$numpy()
. In older versions of R it works. We could change the test to something like as.logical((all(y[all_dims(), 1] == y[,,,,1]))$numpy()) == TRUE
. Tested in R-3.6.3 locally and PASSED. Will test via Travis.test_torch_core.R:211: warning: narrow the condition has length > 1 and only the first element will be used
but all test passed.- if [ "$TRAVIS_OS_NAME" = "osx" ]; then conda install nomkl;fi
in .travis.yml to be able to get rid off an error related to OMP003.9004-fix-examples-torch-byte-to-long
with develop
.> rTorch:::install_conda(package="pytorch=1.4", envname="r-torch", conda="auto", conda_python_version = "3.6", pip=FALSE, channel="pytorch", extra_packages=c("torchvision", "cpuonly", "matplotlib", "pandas"))
fix-readme-add-tests
.checkRd: (5) rTorch.Rd:0-7: Must have a \description
. Also stops in travis-ci.org.1.6
to 1.1
to debug error in rTorch.Rd#' PyTorch bindings for R
. The problem originated by the new R version.rTorch:::install_conda(package="pytorch=1.6", envname="r-torch", conda="auto", conda_python_version = "3.6", pip=FALSE, channel="pytorch", extra_packages=c("torchvision", "cpuonly", "matplotlib", "pandas"))
. Run tests. Run devtools::check(). All passed.--run-donttest
option to check() arguments. Getting errors.all_dims()
examples in generics.R.logical_not()
examples in generics.R.[.torch.Tensor
examples in extract.R.torch_extract_opts
examples in extract.R.dontrun
examples that passed in the local machine. What is different is the PyTorch version specified in .travis.yml
. Changing variable from "1.1"" to PYTORCH_VERSION="1.6"
.pytorch-cpu==1.6
in command 'rTorch::install_pytorch(method="conda", version=Sys.getenv("PYTORCH_VERSION"), channel="pytorch", conda_python_version="3.6")'
. We need to modify function install_pytorch()
.R version 4.0.0 (2020-04-24) -- "Arbor Day"
rTorch::pytorch_install()
. Use instead rTorch:::conda_install()
.libstdc++.so.6
in the Linux installation. This is confusing Python.LD_LIBRARY_PATH=${TRAVIS_HOME}/miniconda/lib
.Rscript -e 'install.packages(c("logging", "reticulate", "jsonlite", "R6", "rstudioapi", "data.table"))
test_tensor_dim.R
because throwing error due to lack of memory.* checking for future file timestamps ... NOTE. unable to verify current time
.fix-elimination-cpu-suffix
to address removal of suffix by developer.rTorch:::install_conda(package="pytorch=1.1", envname="r-torch", conda="auto", conda_python_version = "3.6", pip=FALSE, channel="pytorch", extra_packages=c("torchvision", "cpuonly", "matplotlib", "pandas"))
test_types.R
. Minor changes in reticulate
makes it more sensitive.mnist
dataset until internal tests are resolvedVERSIONS <- c("1.1", "1.0", "1.2", "1.3", "1.4", "1.5", "1.6")
in test_info.R
extract syntaxsys:1: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at /opt/conda/conda-bld/pytorch_1595629417679/work/torch/csrc/utils/tensor_numpy.cpp:141.)
.expect_all_true()
in utils.R
that shortens a test with multiple TRUE returning from conditionr_to_py
to R array and then copying with r_to_py(r_array)$copy()
before converting to tensortensor_logical_and()
and tensor_logical_or()
in generics.R
-which use NumPy logical functions - to make a copy before converting the numpy array to a tensoras_tensor()
function in tensor_functions.R with torch$as_tensor()
. Use make_copy() to prevent PyTorch warning.\dontrun
by \donttest
where applicable\value
to all functions with @return
cran-comments.md
appveyor.yml
appveyor
scripts now are called from this repo. Original source is at krlmlr/r-appveyor.travis.yml
pytorch
channel in reticulate.R
.install.R
rsuite
.a %% b
test_generics.R
to use new function expect_true_tensor
any
and all
. Add examplesmnist_fashion_inference.Rmd
:mnist_fashion_inference.Rmd
.simple_linear_regression.Rmd
.linear_regression_rainfall_builtins.Rmd
linear_regression_rainfall.Rmd
png_images_minist_digits.Rmd
. It uses PBG images in a local folder instead of downloading MNIST idx format images.idx_images_minist_digits.Rmd
two_layer_neural_network.Rmd
. Had some problem with the tensor types. Fixed by using shorter generic version of the tensor gradient operation.py_run_string("import torch")
rpystats-apollo11
NEWS.md
file to track changes to the package.