R/time_series_core.R

Defines functions TSeries_create show_array maybe_unsqueeze

Documented in maybe_unsqueeze show_array TSeries_create

#' @title Maybe_unsqueeze
#'
#' @description Add empty dimension if it is a rank 1 tensor/array
#'
#'
#' @param x R array/matrix/tensor
#' @return array
#' @export
maybe_unsqueeze <- function(x) {

  tms()$core$maybe_unsqueeze(
    x = x
  )

}


#' @title Show_array
#'
#' @description Show an array on `ax`.
#'
#'
#' @param array R array
#' @param ax axis
#' @param figsize figure size
#' @param title title, text
#' @param ctx ctx
#' @param tx tx
#' @return None
#'
#'
#' @examples
#'
#' \dontrun{
#'
#' arr = as.array(1:10)
#' show_array(arr,title = 'My R array') %>% plot(dpi = 200)
#'
#' }
#'
#'
#'
#' @export
show_array <- function(array, ax = NULL, figsize = NULL, title = NULL, ctx = NULL, tx = NULL) {

  tms()$core$show_array(
    array = array,
    ax = ax,
    figsize = figsize,
    title = title,
    ctx = ctx,
    tx = tx
  )

}


#' @title TSeries_create
#' @param x tensor
#' @param ... additional parameters
#' @return tensor
#'
#'
#'
#' @examples
#'
#' \dontrun{
#'
#' res = TSeries_create(as.array(runif(100)))
#' res %>% show(title = 'R array') %>% plot(dpi = 200)
#'
#' }
#'
#'
#' @export
TSeries_create <- function(x, ...) {

  tms()$core$TSeries$create(
    x = x,
    ...
  )

}

Try the fastai package in your browser

Any scripts or data that you put into this service are public.

fastai documentation built on March 31, 2023, 11:41 p.m.