Skip to content

Commit

Permalink
Try something tricky from the PySoundfile source to get docs to build…
Browse files Browse the repository at this point in the history
… without libsndfile installed
  • Loading branch information
JohnVinyard committed Aug 27, 2017
1 parent 369ea90 commit e73c27f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
Empty file added docs/__init__.py
Empty file.
Empty file added docs/source/__init__.py
Empty file.
8 changes: 6 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import shlex
import sys

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, '.')
sys.path.insert(0, os.path.abspath('../../'))

# -- General configuration ------------------------------------------------
Expand Down Expand Up @@ -292,3 +292,7 @@

# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False

# Fake imports
import fake_cffi
sys.modules['cffi'] = sys.modules['fake_cffi']
15 changes: 15 additions & 0 deletions docs/source/fake_cffi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class FFI(object):

def cdef(self, _):
pass

def dlopen(self, _):
return self

def string(self, _):
return b'not implemented'

def sf_version_string(self):
return NotImplemented

SFC_GET_FORMAT_INFO = NotImplemented
7 changes: 5 additions & 2 deletions zounds/learn/gan_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ def train(self, data, epochs, batch_size):
data = data.astype(np.float32)

zdim = self.latent_dimension

# TODO: These dimensions work for vanilla GANs, but need to be
# reversed (batch_size, zdim, 1) for convolutional GANs
noise = torch.FloatTensor(batch_size, 1, zdim)
fixed_noise = torch.FloatTensor(batch_size, 1, zdim).normal_(0, 1)

noise_shape = (batch_size,) + self.latent_dimension
noise = torch.FloatTensor(*noise_shape)
fixed_noise = torch.FloatTensor(*noise_shape).normal_(0, 1)
label = torch.FloatTensor(batch_size)
real_label = 1
fake_label = 0
Expand Down

0 comments on commit e73c27f

Please sign in to comment.